| Prev |   1   2   3     4   | Next | Last
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900) (https://talk.maemo.org/showthread.php?t=44576)

noobmonkey 2010-02-17 23:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
ok figured out
hildon.hildon_gtk_window_set_progress_indicator(di alog, 1)
then
hildon.hildon_gtk_window_set_progress_indicator(di alog, 0)

If i put Import hildon at the top, i get segmentation errors
if i leave it out i get Global name 'hildon' not defined... grrrrrrrrr!!

fatalsaint 2010-02-17 23:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 533281)
ok figured out
hildon.hildon_gtk_window_set_progress_indicator(di alog, 1)
then
hildon.hildon_gtk_window_set_progress_indicator(di alog, 0)

If i put Import hildon at the top, i get segmentation errors
if i leave it out i get Global name 'hildon' not defined... grrrrrrrrr!!

hildon is GTK-based.. you'll need GTK and QT going about it this way .. if possible.

Unfortunately I haven't had to deal with integrating QT into the GTK desktop yet so I can't help you out here.

noobmonkey 2010-02-17 23:52

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
shattered and almost time for bed!

All working fine :)

As the code is small, may strip the bit i need out, and start again in QTdesigner :) - just paste them back in when needed.

noobmonkey 2010-02-18 11:16

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
3 Attachment(s)
changed the latest version a little bit.

made everything smaller and neater.
added maemo firmware version.

hartti 2010-02-18 22:41

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
@noobmonkey, how do you get the maemo firmware version number?

I tried os.uname() but it does not seem to return it and os.name is no help either...

Hartti

qwerty12 2010-02-18 22:48

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by hartti (Post 535509)
@noobmonkey, how do you get the maemo firmware version number?

I tried os.uname() but it does not seem to return it and os.name is no help either...

Hartti

I'm not noobmonkey, but "osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION" returns it...

noobmonkey 2010-02-18 23:00

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 535520)
I'm not noobmonkey, but "osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION" returns it...

Qwerty, you really are a fountain of knowledge :D :D

I didnt know that (Bearing in mind i have 2 weeks of linux, and one week of python, i'd go with qwerty!)

I used a completely different, longer approach lol......

Code:

var_l_MaemoV = os.popen('dpkg -l "mp-fremantle-*"').read()
self.lbl_Maemo_Ver_Info.setText(var_l_MaemoV.strip()[-15:])


qwerty12 2010-02-18 23:03

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 535535)
I didnt know that (Bearing in mind i have 2 weeks of linux, and one week of python, i'd go with qwerty!)

FWIW, I'm a Windows person :p

noobmonkey 2010-02-18 23:06

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 535543)
FWIW, I'm a Windows person :p

Pen and paper rules lol ;)

hehe me too, but python i'm understanding :) - well, except for some lack of documentation issues, if i can't find the obvious answer, i'll hunt terminal for my answer.... :) (Googling terminal commands is soooo much easier then pymaemo stuff!!)

hartti 2010-02-18 23:32

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Ok. Calling that through os.popen() seems to work. Cool.
(I was expecting there to be a python module for getting this without command line stuff :-)

Thanks qwerty12!

Hartti

noobmonkey 2010-02-18 23:34

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by hartti (Post 535591)
Ok. Calling that through os.popen() seems to work. Cool.
(I was expecting there to be a python module for getting this without command line stuff :-)

Thanks qwerty12!

Hartti


There is :) - Qwerty's post stated -
"osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION"

But i havn't tried using it :)


At least it works :)

hartti 2010-02-18 23:43

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
I was expecting that there is a method yyyy in module xxxx, which I could just call and get the version number. Like
version = yyyy.xxxx()

I got qwerty12's trick to work with the following code. To me that still looks like calling a command line command from the python code :-)

import os
a = os.popen("osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION")
version = a.next()
a.close()

Hartti

noobmonkey 2010-02-18 23:46

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by hartti (Post 535614)
I was expecting that there is a method yyyy in module xxxx, which I could just call and get the version number. Like
version = yyyy.xxxx()

I got qwerty12's trick to work with the following code. To me that still looks like calling a command line command from the python code :-)

import os
a = os.popen("osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION")
version = a.next()
a.close()

Hartti


AHhh good point - dont think there is an api/lib for everything yet :( - a few i have read looked great until i saw the line (FIX: Blah blah not working, needs to be added)

Work in progress! - if you do find a better way, would be nice to know :D

noobmonkey 2010-02-19 13:03

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
anyone know a way to list all repo's and determine enabled v disabled?

hartti 2010-02-19 16:55

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
let's wait for qwerty12 to answer :-)

Hartti

fatalsaint 2010-02-19 17:19

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Well.. this probably won't work and is certainly overly complicated.. but I don't know of a way to list repo's directly from apt. This makes use of tricks with find and grep, both of which are probably bastardized versions on the N900 and will probably not work.

Code:

#!/usr/bin/python                                                             
import commands                                                               
                                                                               
enabled = commands.getoutput('find /etc/apt -name *.list -exec grep -v "^#" {} \
; | grep -v "^$"')                                                             
disabled = commands.getoutput('find /etc/apt -name *.list -exec grep "^#" {} \;
| grep -Ev "^#\W*$"')                                                         
                                                                               
print "Enabled Repositories \n\n" + enabled                                   
                                                                               
print "\n\nDisabled Repositories \n\n" + disabled

Fortunately.. you could totally python-ify this which would work on the N900... just search for all *.list files in /etc/apt and open them, then look for a # at the beginning of the line. Those with a # are disabled, those without are enabled.

fatalsaint 2010-02-19 17:24

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Code:

apt-cache policy
Will show active repo's it appears..

qwerty12 2010-02-19 17:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 536505)
anyone know a way to list all repo's and determine enabled v disabled?

If you mean disabled in the sense that it's been unticked (well, the "disabled" button for a particular catalogue ticked) in the Application Manager, you can look in the file /etc/hildon-application-manager/catalogues and disabled catalogues will have an <disabled/> element.

fatalsaint 2010-02-19 17:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 536920)
If you mean disabled in the sense that it's been unticked in the Application Manager, you can look in the file /etc/hildon-application-manager/catalogues and disabled catalogues will have an <disabled/> element.

That's kind of cool... will that show repo's that are in the normal sources.list as well as hildon-application-manager.list (or whatever that one was called)? Or just those that HAM controls? (I would assume the latter.. but never know.)

qwerty12 2010-02-19 17:31

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 536922)
That's kind of cool... will that show repo's that are in the normal sources.list as well as hildon-application-manager.list (or whatever that one was called)? Or just those that HAM controls? (I would assume the latter.. but never know.)

Pretty sure it's the latter, AFAIK.

noobmonkey 2010-02-19 19:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
you two really are very helpful!
Trying each of them, but onto the next bit :)

I have a string full of lots of words (for example apt-cache pkgnames)

So my String looks like:
entry1
entry2
entry 3....
entry 200

etc..

Trying to add these to a QT listwidget, but guessing readlines and xreadlines are only for reading files. Is there a python code to read lines within a string? or is it a bit more complicated then that?

Tried with this:

Code:

for line in j.readlines():
            self.listWidget.addItem(line)


fatalsaint 2010-02-19 19:33

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Code:

for line in j.split("\n"):
            self.listWidget.addItem(line)

Maybe?

noobmonkey 2010-02-19 19:36

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 537148)
Code:

for line in j.split("\n"):
            self.listWidget.addItem(line)

Maybe?

Yup worked perfectly :)

Just ordered a basic python book so i don't need to harrass you both so much :)

But really enjoying this!! :D :D

noobmonkey 2010-02-20 16:02

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
1 Attachment(s)
Just a quick update on my progress today :)

anyone want any particular info added?

latest screeny!!
Edit - i need to change maemo version to Firmware - bit confusing at the mo!

noobmonkey 2010-02-20 17:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Hmmmm running out of ideas on what else to do....

Version 0.3
Battery Status
Accelerometer readout
GPS Position
Firmware version
Roots Free / Used
CPU Information
N900 Hardware board info
System Locale
Front Camera image test


List of enabled repositories
List of disabled repositories
List of installed applications + App info
Run commands, apt-get clean etc...
Phone/Cell information


Green = Working
Red = In Progress

Interested to hear if anyone has any specific other requirements? - will add them to the todo list.

Waiting on liblocation to get some decent pymaemo calls, device.cell_info would be great! (Although could be a long wait?!)

Anyway, would appreciate any feedback or ideas :)

qwerty12 2010-02-20 17:59

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 538682)
Waiting on liblocation to get some decent pymaemo calls, device.cell_info would be great! (Although could be a long wait?!)

You don't strictly need liblocation for cell information.

Look at the command "dbus-send --system --print-reply --type=method_call
--dest=com.nokia.phone.net /com/nokia/phone/net
Phone.Net.get_registration_status"

The following snippet, from
http://www.bleb.org/software/maemo/telephony-maemo.c, explains the
return values:
DBUS_TYPE_BYTE, &status,
DBUS_TYPE_UINT16, &lac,
DBUS_TYPE_UINT32, &cell_id,
DBUS_TYPE_UINT32, &operator_code,
DBUS_TYPE_UINT32, &country_code,
DBUS_TYPE_BYTE, &network_type,
DBUS_TYPE_BYTE, &supported_services,
DBUS_TYPE_INT32, &net_err,

I don't know dbus-python, but http://repository.maemo.org/extras-d...urce/n/netmon/ could probably help in that regard.

noobmonkey 2010-02-20 19:05

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
ooo Qwerty you minx!

Will try it out later tonight!! :) :)

noobmonkey 2010-02-20 22:52

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
well, it definitley works.... can get the readout of signal and cell info! very impressed.

it does throw up an odd error in terminal though. continues to work, so bit confused...

Code:

ERROR:dbus.proxies:Introspect error on :1.17:/com/nokia/phone/net: dbus.exceptions.DBusException: rpc.Error: object /com/nokia/phone/net doesn't have interface org.freedesktop.DBus.Introspectable
ok well i can see the error is thown from a dbus call, but very confused as the call works....

noobmonkey 2010-02-20 23:38

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Well it definitley works... tried a few other calls, can get the imei number through the call:

dbus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei

But still getting the introspect errors.... (Each call throws up one error)... i'm assuming they get ignored, as if i was not looking at terminal, i would never know there was an error......
(Just wanting to make a nice clean app!)

evad 2010-02-21 01:22

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 538726)
I don't know dbus-python, but http://repository.maemo.org/extras-d...urce/n/netmon/ could probably help in that regard.

You are my man! This is (almost) exactly what I needed :) Thanks!

noobmonkey 2010-02-21 10:39

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by evad (Post 539152)
You are my man! This is (almost) exactly what I needed :) Thanks!


evad, will send you through the code with the cell and imei info printing off :D (On my example) ... but...... still getting those errors!!

qwerty12 2010-02-21 10:52

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 539489)
but...... still getting those errors!!

I'd say "ignore them". I'm not well-versed in python-dbus, not at all, but D-Bus services can have introspection data attached to them and programs/people can query this introspection data to see what methods et al. a service provides. Python-dbus tries to "make it easier" for the programmer by querying the service to see what services it provides and the data types of the return values of a method call.
As you saw, the Phone.Net interface doesn't implement the Introspectable interface so it cannot be asked to list the methods etc. it has. You may be able to find a way to stop python-dbus from asking but I wouldn't bother for two reasons:
  • Who's gonna run it from the console, anyway?
  • "Don't fix it if it's not broken." - I mean, querying the services works and you get the information that you want, right?

noobmonkey 2010-02-21 12:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
1 Attachment(s)
ok well next update screenshot and version update:

Version 0.3
Battery Status
Accelerometer readout
GPS Position
Firmware version
Roots Free / Used
CPU Information
N900 Hardware board info
System Locale
Front Camera image test
Phone/Cell information


List of enabled repositories
List of disabled repositories
List of installed applications + App info
Run commands, apt-get clean etc...



Green = Working
Red = In Progress

Edit - in case you are wondering what my camera is allways pointing at... It's my lamp.... the front camera is rubbish so i need to point it at something bright!

noobmonkey 2010-02-21 12:40

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
lol.... just noticed my longitude value has screwballed..... Hmm mwill go fix!

noobmonkey 2010-02-21 13:00

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
aghhhh confused... i read somewhere on here last night that someone had the same problem with the failed 0's on long.........

But can't find it anywhere!!

noobmonkey 2010-02-21 13:12

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Fixed it..... Think it was a GPS warm up issue (annoying that it didnt do it before).... Just lopped it a few times and it works fine.

noobmonkey 2010-02-21 13:15

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Right i'm getting to a point where is it almost publishable but there are a few things i would really like to do before i let it loose on people

Version 0.3
Battery Status
Accelerometer readout
GPS Position
Firmware version
Roots Free / Used
CPU Information
N900 Hardware board info
System Locale
Front Camera image test
Phone/Cell information


Planned for V0.4
List of enabled repositories
List of disabled repositories
List of installed applications + App info
Run commands, apt-get clean etc...
Add Altitude to GPS details
(Already coded)

Planned for V0.5 - extras dev Release
Threading - to speed the whole thing up....

Green = Working
Red = In Progress

casper27 2010-02-21 13:19

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Great work Noob cant wait to test it. Should be a usefull application.

noobmonkey 2010-02-21 13:50

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by casper27 (Post 539637)
Great work Noob cant wait to test it. Should be a useful application.

Hehe good to hear, and thank you very much :) - it will need a lot of testing! :D
Hard for me to test what happens if hardware isn't working, got it covered on most and it should display errors... but will soon see!

Currently it's got a 10-20 second load time... so really i need to do the threading to make it usable :D

noobmonkey 2010-02-21 14:42

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
1 Attachment(s)
jumped ahead of myself slightly....
managed to get GTK threading working fine. load up now takes 6-10 seconds, and the update takes 4-5 seconds.

fixed the lat/long issues. do people want me to remove the other tabs and throw up an extras - dev version? (never done it before. may take a while).
Version 0.4
Battery Status
Accelerometer readout
GPS Position
Firmware version
Roots Free / Used
CPU Information
N900 Hardware board info
System Locale
Front Camera image test
Phone/Cell information
Multi-threading


Planned for V0.5
List of enabled repositories
List of disabled repositories
List of installed applications + App info
Run commands, apt-get clean etc...
Add Altitude to GPS details
(Already coded)


Green = Working
Red = In Progress


| Prev |   1   2   3     4   | Next | Last
All times are GMT. The time now is 19:33.

vBulletin® Version 3.8.8