×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    User defined data format in FORM?

    Hi Forum,
    I'd like to know if it is possible to use Forms with user defined formats? (e.g. for the input of IP-Adresses i'd like to predefine three dots: ***.***.***.***, or for the input of BLue-Tooth addresses: **:**:**:**:**:**)

    Thx a lot
    novis

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    India
    Posts
    133

    Re: User defined data format in FORM?

    Quote Originally Posted by novis View Post
    Hi Forum,
    I'd like to know if it is possible to use Forms with user defined formats? (e.g. for the input of IP-Adresses i'd like to predefine three dots: ***.***.***.***, or for the input of BLue-Tooth addresses: **:**:**:**:**:**)

    Thx a lot
    novis
    Hi,

    There is an example of Form here which might help you.
    Kandyfloss

    V 7.0642.0
    18-10-06
    RH-51
    Nokia 7610

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: User defined data format in FORM?

    Thx kandyfloss,
    but this example just uses the predefined formats for date (**/**/**) and time (**:**:**).
    I need a form for IP-addresses (***.***.***.***) and Blue-Tooth addresses (**:**:**:**:**:**).
    I couldn't find anything like this in the Library Reference. So I guess it is not possible in python?
    Any suggestions?

  4. #4
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Re: User defined data format in FORM?

    Quote Originally Posted by novis View Post
    Thx kandyfloss,
    but this example just uses the predefined formats for date (**/**/**) and time (**:**:**).
    I need a form for IP-addresses (***.***.***.***) and Blue-Tooth addresses (**:**:**:**:**:**).
    I couldn't find anything like this in the Library Reference. So I guess it is not possible in python?
    Any suggestions?
    Hi,

    It may be possible if you write an extension for it.

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: User defined data format in FORM?

    Quote Originally Posted by novis View Post
    Thx kandyfloss,
    but this example just uses the predefined formats for date (**/**/**) and time (**:**:**).
    I need a form for IP-addresses (***.***.***.***) and Blue-Tooth addresses (**:**:**:**:**:**).
    I couldn't find anything like this in the Library Reference. So I guess it is not possible in python?
    Any suggestions?
    hi novis
    croozeus is correct in python the format is already predefined if u wnt to change it u better write a extension.
    hope u r satisfied

  6. #6
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    153

    Re: User defined data format in FORM?

    Thx guys,
    ok, if this is the way I'll go for it
    can u recommend an easy "how-to write your own extensions" on the web?
    I want to find a good start as I've never done this so far.

  7. #7
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Re: User defined data format in FORM?

    Hi Novis,

    Go throught this
    http://wiki.opensource.nokia.com/pro...ing_extensions
    It will definitelty prove useful.

    Best Regards
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  8. #8
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    107

    Re: User defined data format in FORM?

    BTW, how can I make Tabs in a form? I already have too many settings for only one tab.

  9. #9
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: User defined data format in FORM?

    Quote Originally Posted by carknue View Post
    BTW, how can I make Tabs in a form? I already have too many settings for only one tab.
    Might be better to use a scrolling list for Settings! That's more S60 style.

    Cheers,

    --jouni

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: User defined data format in FORM?

    Quote Originally Posted by carknue View Post
    BTW, how can I make Tabs in a form? I already have too many settings for only one tab.
    hi carknue
    plz check the code i have written below just in place of the text in the tabs pass ur functions which will contain ur forms.
    import e32, appuifw
    ## Receive the index of the active tab.
    # @param aIndex Index of the active tab
    def tabs_handler( aIndex ):
    # put focus on the right tab
    appuifw.app.activate_tab( aIndex )
    # set the tab view
    appuifw.app.body = view_stack[aIndex]


    if __name__ == "__main__":
    ## Active object lock
    APP_LOCK = e32.Ao_lock()

    # title + exit key handler
    appuifw.app.title = u'Tabs example'
    appuifw.app.exit_key_handler = lambda:APP_LOCK.signal()

    ## Tabs labels as a list
    tabs = [u't0',u't1',u't2',u't3',u't4']

    ## list for the views
    view_stack = []


    ## View 0
    v0 = appuifw.Text(u'Tab 0')
    view_stack.append(v0)

    ## View 1
    v1 = appuifw.Text(u'Tab 1')
    view_stack.append(v1)

    ## View 2
    v2 = appuifw.Text(u'Tab 2')
    view_stack.append(v2)

    ## View 3
    v3 = appuifw.Text(u'Tab 3')
    view_stack.append(v3)

    ## View 4
    v4 = appuifw.Text(u'Tab 4')
    view_stack.append(v4)

    # Set tabs active + event handler
    appuifw.app.set_tabs( tabs, tabs_handler )

    # activate the view 0
    tabs_handler( 0 )


    # wait for signal
    APP_LOCK.wait( )

    # remove tabs when exiting or they remain in the Python shell
    appuifw.app.set_tabs([],None)
    hope its work plz give a feedback
    thanx
    Last edited by gaba88; 2008-03-20 at 15:43. Reason: typo error

  11. #11
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    107

    Re: User defined data format in FORM?

    @JOM We already have 18 different Settings in our setup form, so it take quite a while to scroll down.

    So, the main application already uses tabs, but we defined this as a setup form:

    Code:
    class Setup( object ):
    	# Config constants
    	SOUND_OFF = 0
    	SOUND_SOUND = 1
    	SOUND_VOICE = 2
    
    	LIGHT_OFF = 0
    	LIGHT_CELL = 1
    	LIGHT_ALWAYS = 2
    
    	VOICE_CELL = 0
    	VOICE_BAND = 1
    	VOICE_BAND_LAC = 2
    	VOICE_BAND_LAC_NET = 3
    	VOICE_BAND_CLF = 4
    
    	GPS_INTERNAL = 0
    	GPS_EXTERNAL = 1
    	
    	CLF_DEVICE = 0
    	CLF_CARD = 1
    	
    	WLAN_DEVICE = 0
    	WLAN_CARD = 1
    
    	WLAN_NOTIFY_OFF = 0
    	WLAN_NOTIFY_ADHOC = 1
    	
    	BT_DEVICE = 0
    	BT_CARD = 1
    	
    	BT_NOTIFY_OFF = 0
    	BT_NOTIFY_NEW_VOICE = 1
    	BT_NOTIFY_NEW_LIGHT = 2
    	BT_NOTIFY_NEW_VOICE_LIGHT = 3
    	
    	## The constructor.
    	def __init__( self ):
    		global config
    		## Config options
    		self._iSound = [u'OFF', u'Sound', u'Voice']
    		self._iLight = [u'OFF', u'Cell change on', u'Always on']
    		self._iVoice = [u'Cell only',
    		                u'Band & Cell',
    		                u'Band & Cell & LAC',
    		                u'Band & Cell & LAC & NET',
    						u'Band & CLF']
    		self._iGPS = [u'Internal', u'External']
    		self._iCLF = [u'Device', u'Memory Card']
    		self._iWLAN_Store = [u'Device', u'Memory Card']
    		self._iWLAN_Notify = [u'OFF', u'AD-HOC']
    		self._iBT_Store = [u'Device', u'Memory Card']
    		self._iBT_Notify = [u'OFF', u'Voice', u'Light', u'Voice & Light']
    		## Setup Menu
    		self._iMenu = [(u'Defaults', self.defaultConfig),
    		               (u'Reload Config File', self.loadConfig)]
    		## Form fields
    		self.configToForm()
    		#flags = appuifw.FFormEditModeOnly
    		flags = appuifw.FFormEditModeOnly + appuifw.FFormDoubleSpaced
    		self._iForm = appuifw.Form(self._iFields, flags)
    		self._iForm.save_hook = self.saveForm
    		#self._iForm.flags = appuifw.FFormEditModeOnly
    		self._iForm.menu = self._iMenu
    
    	def configToForm(self):
    		global config
    		_iFields = [( u'Cellselection Notifier', 'combo', ( self._iSound, config['CellNotify'] ) ),
    		            ( u'Light', 'combo', ( self._iLight, config['Light'] ) ),
    		            ( u'WLAN Scan [s] (off=0 / on>9)','number', config['Refresh'] ),
    		            ( u'Volume','number', config['Volume'] ),
    		            ( u'Voice Text','combo', (self._iVoice, config['Voice']) ),
    		            ( u'GPS', 'combo', ( self._iGPS, config['GPS'] ) ),
    					( u'Neighbour Radius [km]', 'float', config['Neighbour Radius']),
    					( u'WLAN Autosave Interval [min]','number', config['WLANInter']),
    					( u'CLF stored on','combo', (self._iCLF, config['CLF'])),
    					( u'WLAN Database stored on','combo', (self._iWLAN_Store, config['WLAN_STORE'])),
    					( u'WLAN Notifier','combo', (self._iWLAN_Notify, config['WLAN_NOTIFY'])),
    					( u'Map Zoom Level (1-12)','number', config['MAPZOOM']),
    					( u'Sec between BT Scans 0=off','number', config['BT_SCAN']),
    					( u'BT Database stored on','combo', (self._iBT_Store, config['BT_STORE'])),
    					( u'BT Notifier','combo', (self._iBT_Notify, config['BT_NOTIFY'])),
    					( u'BT Autosave Interval [min]','number', config['BT_Autosave']),
    					( u'BT Scan Timeout [s]','number', config['BT_SCAN_TIMEOUT'])]
    		## XXX: live update doesn't work yet. Need fixing
    		if hasattr(self, '_iFields'):
    			for i in range(len(_iFields)):
    				self._iFields[i] = _iFields[i]
    		else:
    			self._iFields = _iFields
    
    	def formToConfig(self):
    		global config
    		## XXX: must find elegant way for conversion Form <-> config
    		config = {
    			'CellNotify': self._iFields[0][2][1],
    			'Light': self._iFields[1][2][1],
    			'Refresh': self._iFields[2][2],
    			'Volume': self._iFields[3][2],
    			'Voice': self._iFields[4][2][1],
    			'GPS': self._iFields[5][2][1],
    			'Neighbour Radius': self._iFields[6][2],
    			'WLANInter': self._iFields[7][2],
    			'CLF': self._iFields[8][2][1],
    			'WLAN_STORE': self._iFields[9][2][1],
    			'WLAN_NOTIFY': self._iFields[10][2][1],
    			'MAPZOOM': self._iFields[11][2],
    			'BT_SCAN': self._iFields[12][2],
    			'BT_STORE': self._iFields[13][2][1],
    			'BT_NOTIFY': self._iFields[14][2][1],
    			'BT_Autosave': self._iFields[15][2],
    			'BT_SCAN_TIMEOUT': self._iFields[16][2]
    			}
    		cfgfile = open(configfile, 'wt')
    		cfgfile.write(repr(config))
    		cfgfile.close()
    
    	def defaultConfig(self):
    		global config, defconfig
    		config = defconfig.copy()
    		self.configToForm()
    		appuifw.note(u"Please reopen the Setup dialog.")
    
    	def loadConfig(self, silent=False):
    		global config
    		config = defconfig.copy()
    		try:
    			cfgfile = open(configfile, 'rt')
    			content = cfgfile.read()
    			cfgfile.close()
    
    			config.update(eval(content))
    			if not silent:
    				appuifw.note(u"Please reopen the Setup dialog.")
    		except IOError, error:
    			if not silent:
    				appuifw.note(unicode(error),'error')
    		self.configToForm()
    
    	## Displays the form.
    	def execute( self ):
    		self._iForm.execute( )
    
    	## save_hook send True if the form has been saved.
    	def saveForm( self, aConfig ):
    		global config
    		self._iFields = aConfig
    		self.formToConfig()
    And is is called this way with the setup funktion:

    Code:
    def setup():
    	global btscan, wscan
    	# Bug in Form(): manually hide Tabs
    	appuifw.app.set_tabs([], None)
    	SetupForm.execute( )
    	if config['Refresh']<2:
    		wscan = []
    	if bt and (config['BT_SCAN'] > 0):
    		if blues.getstate() == 0:
    			blues.on()
    	if config['BT_SCAN'] == 0:
    		btscan = []
    	menus_setup()
    I would like to split these settings into different tabs for gsm, WLAN and Bluetooth and general settings. How could I do this in a simple way or do I have to define 4 different setup forms?

  12. #12
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: User defined data format in FORM?

    Quote Originally Posted by carknue View Post
    @JOM We already have 18 different Settings in our setup form, so it take quite a while to scroll down.
    Usability studies showed that people don't realize what "tabs" are or how to handle them. As result they will process only the default tab and miss all the others.

    I would like to split these settings into different tabs for gsm, WLAN and Bluetooth and general settings. How could I do this in a simple way or do I have to define 4 different setup forms?
    Use one "toplevel" listbox where each row points to each separate tab, that's four items. Everything is still visible on-screen at the same time.

    (Yes, usability studies have shown that people don't recognize scrollbar nor know how to deal with it. As result they process only those listbox items which happen to be visible )

    For power-users provide tabs to enable fast change from one settings group to another. RSK will always bring user to the listbox mentioned earlier.

    ...how to do it... Use C++ Sorry, haven't used tabs nor listboxes in python, just checked manual that they are supposed to be there. My guess is that you just have to hardcode them manually. Or invent nice generic system to generate listbox + tabs, but this will require 3x more time than hardcoding. Might be more fun, though!

    Cheers,

    --jouni

Similar Threads

  1. AT commands - sending ringtone using PDU
    By liangzhuge in forum Smart Messaging
    Replies: 39
    Last Post: 2007-04-06, 10:18
  2. Replies: 0
    Last Post: 2004-11-24, 18:49
  3. User Data Header and Long Message relationship
    By wookmi in forum General Messaging
    Replies: 3
    Last Post: 2003-10-06, 01:01
  4. Internet Access Config via Smart Message
    By ajbrindley in forum Smart Messaging
    Replies: 1
    Last Post: 2002-08-14, 07:56
  5. Replies: 1
    Last Post: 2002-05-24, 06:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×