View Single Post
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#615
Originally Posted by qwerty12 View Post
Apologies for providing a half-assed FMTxFrequency function. I should've known better as I wrote a clone of the status bar applet...

Code:
import gettext #part of standard Python, I believe 

def FMTxFrequency():
	freq = "%.1f" % float(GetProp(FMTxPropertiesInterfaceConnect(), 'frequency') / 1000.0)
	freq_mhz = gettext.dgettext("osso-fm-transmitter", "fmtx_va_frequency")
	if freq_mhz != "fmtx_va_frequency":
		freq_mhz %= freq
		return freq_mhz
	return freq
Oh, it returns a str so no need for manual casts

P.S. You can pass False (introspection=False) as the third argument of your get_object calls to stop it from introspecting the given interface and producing those error messages
Haha! Spent a while last night trying to get it to return correctly! never thought to divide by 1000.0 instead of 1000!
Thank you very much!
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -

Last edited by noobmonkey; 2010-06-08 at 07:57.
 

The Following 2 Users Say Thank You to noobmonkey For This Useful Post: