Example #1
0
def myRadButLisLabel(name=["One","Two","Three"], 
					 chil=None, valu=False, 
					 call=None, data=['dati'],
					 nLab='Label', cLab=None,
					 tBox='h', aBox=[False, False, 1]):
	"""     nLab name
			cLab color
	"""

	#callback debug
	def on_clicked(widg, ind, *data):
		ena = widg.get_active()
		if ena:
			print "a", "%05s" %widg.props.label.replace('_',''),
			print ind, data 
		
	# in assenza di callback uso quella di debug
	if call == None:
		call = on_clicked

	# funzione che istanzia oggetti tipo
	def myList(ind):
#myRadButton
		# butt, call
		return myRadButton(name=name[ind], 
						   chil=chil, valu=False, 
						   call=call, data=[ind, data])
#myBoxList
	# xBox, [butt, call] * N
	obje, othe = myBoxList(name=name, tBox=tBox, 
						   aBox=aBox, func=myList)
	# prendo come capogruppo la prima istanza
	gro = othe[0][0].get_group()
	for ele in othe[1:]:
		# imposto il capogruppo alle altre istanze
		ele[0].join_group(gro[0])
	# rendo attivo il button
	if type(valu) == type(1):
		othe[valu][0].set_active(True)
#myLabel
	if cLab == None:
		cLab='blue'
	#name='myLabel', leng=0, prea=' ', post='', font='Arial 10', colo=Gdk.color_parse('black')
	labe = myLabel(name=nLab, 
				   leng=len(nLab)+1, prea=' ', post=' ', 
				   font='Courier 10', 
				   colo=cLab)
	# inserisco la label nella list degli oggetti
	othe.insert(0,[labe])
	# inserisco la label in testa alla box
	#child, expand=True, fill=True, padding=0
	obje.pack_start(labe, False, False, 0)
	obje.reorder_child(labe, 0)
# <-
	return obje, othe
Example #2
0
def myChkButLisLabel(name=["One", "Two", "Three"],
                     valu=False,
                     colo=None,
                     call=None,
                     data=['dati'],
                     nLab='Label',
                     cLab=None,
                     tBox='h',
                     aBox=[False, False, 1]):
    """     nLab name
			cLab color
	"""

    #callback debug
    def on_clicked(widg, ind, *data):
        ena = widg.get_active()
        print "a",
        print ind, data, ("OFF", "ON")[ena]

    # in assenza di callback uso quella di debug
    if call == None:
        call = on_clicked

    # funzione che istanzia oggetti tipo
    def myList(ind):
        #myChkButton
        # butt, call
        return myChkButton(name=name[ind],
                           valu=False,
                           colo=None,
                           call=None,
                           data=[ind, data])
#myBoxList
# xBox, [butt, call] * N

    obje, othe = myBoxList(name=name, tBox=tBox, aBox=aBox, func=myList)
    #myLabel
    if cLab == None:
        cLab = 'blue'
    #name='myLabel', leng=0, prea=' ', post='', font='Arial 10', colo=Gdk.color_parse('black')
    labe = myLabel(name=nLab,
                   leng=len(nLab) + 1,
                   prea=' ',
                   post=' ',
                   font='Courier 10',
                   colo=cLab)
    # inserisco la label nella list degli oggetti
    othe.insert(0, [labe])
    # inserisco la label in testa alla box
    #child, expand=True, fill=True, padding=0
    obje.pack_start(labe, False, False, 0)
    obje.reorder_child(labe, 0)
    # <-
    return obje, othe
Example #3
0
def myChkButLisLabel(name=["One","Two","Three"], 
					 valu=False, colo=None, 
					 call=None, data=['dati'],
					 nLab='Label', cLab=None,
					 tBox='h', aBox=[False, False, 1]):
	"""     nLab name
			cLab color
	"""

	#callback debug
	def on_clicked(widg, ind, *data):
		ena = widg.get_active()
		print "a",
		print ind, data, ("OFF", "ON")[ena]
		
	# in assenza di callback uso quella di debug
	if call == None:
		call = on_clicked

	# funzione che istanzia oggetti tipo
	def myList(ind):
#myChkButton        
		# butt, call
		return myChkButton(name=name[ind], valu=False, colo=None, 
							call=None, data=[ind, data])
#myBoxList
	# xBox, [butt, call] * N
	obje, othe = myBoxList(name=name, tBox=tBox, 
						   aBox=aBox, func=myList)
#myLabel
	if cLab == None:
		cLab= 'blue'
	#name='myLabel', leng=0, prea=' ', post='', font='Arial 10', colo=Gdk.color_parse('black')
	labe = myLabel(name=nLab, 
				   leng=len(nLab)+1, prea=' ', post=' ', 
				   font='Courier 10', 
				   colo=cLab)
	# inserisco la label nella list degli oggetti
	othe.insert(0,[labe])
	# inserisco la label in testa alla box
	#child, expand=True, fill=True, padding=0
	obje.pack_start(labe, False, False, 0)
	obje.reorder_child(labe, 0)
# <-
	return obje, othe
Example #4
0
def myEntLabel(name='myText',
               numb=None,
               call=None,
               data=['dati'],
               nLab='Label',
               cLab="#333",
               tLab='h',
               aLab=[False, False, 1]):
    """ crea una entry text di una certa dimensione 'numb'
		con un testo di default 'text' con associata una
		label alla riga o colonna
		  
		-> name testo da inserire nella entry
		-> numb numero massimo di caratteri visibili 
		-> call funzione da eseguire su evento
		-> data dati da passare alla funzione
		-> nLab nome etichetta 
		-> cLab colore etichetta 
		-> tLab tipo contenitore etichetta v/h 
		-> aLab attributi contenitore etichetta 
	"""
    #myEntry
    # entr, call
    entr, call = myEntry(name=name, numb=numb, call=call, data=data)
    #myLabel
    if cLab == None:
        cLab = Gdk.color_parse('blue')
    # labe
    labe = myLabel(name=nLab,
                   leng=len(nLab) + 1,
                   prea=' ',
                   post=' ',
                   font='Courier 10',
                   colo=cLab)
    #xBox
    xBox = myBox(tLab)
    #child, expand=True, fill=True, padding=0
    xBox.pack_start(labe, *aLab)
    xBox.pack_start(entr, *aLab)
    # <-
    return xBox, [entr, call, labe]
Example #5
0
def myEntLabel(name='myText', 
			   numb=None,
			   call=None, data=['dati'],
			   nLab='Label', cLab="#333",
			   tLab='h', aLab=[False, False, 1]):
	""" crea una entry text di una certa dimensione 'numb'
		con un testo di default 'text' con associata una
		label alla riga o colonna
		  
		-> name testo da inserire nella entry
		-> numb numero massimo di caratteri visibili 
		-> call funzione da eseguire su evento
		-> data dati da passare alla funzione
		-> nLab nome etichetta 
		-> cLab colore etichetta 
		-> tLab tipo contenitore etichetta v/h 
		-> aLab attributi contenitore etichetta 
	"""
#myEntry
	# entr, call
	entr,call = myEntry(name=name,
			  			numb=numb, 
			  			call=call, data=data)
#myLabel
	if cLab == None:
		cLab=Gdk.color_parse('blue')
	# labe
	labe = myLabel(name=nLab, 
					leng=len(nLab)+1, prea=' ', post=' ', 
					font='Courier 10', 
					colo=cLab)
#xBox   
	xBox = myBox(tLab)
	#child, expand=True, fill=True, padding=0
	xBox.pack_start(labe, *aLab)
	xBox.pack_start(entr, *aLab)	
# <-        
	return xBox, [entr, call, labe]
Example #6
0
def myRadButLisLabel(name=["One", "Two", "Three"],
                     chil=None,
                     valu=False,
                     call=None,
                     data=['dati'],
                     nLab='Label',
                     cLab=None,
                     tBox='h',
                     aBox=[False, False, 1]):
    """     nLab name
			cLab color
	"""

    #callback debug
    def on_clicked(widg, ind, *data):
        ena = widg.get_active()
        if ena:
            print "a", "%05s" % widg.props.label.replace('_', ''),
            print ind, data

    # in assenza di callback uso quella di debug
    if call == None:
        call = on_clicked

    # funzione che istanzia oggetti tipo
    def myList(ind):
        #myRadButton
        # butt, call
        return myRadButton(name=name[ind],
                           chil=chil,
                           valu=False,
                           call=call,
                           data=[ind, data])
#myBoxList
# xBox, [butt, call] * N

    obje, othe = myBoxList(name=name, tBox=tBox, aBox=aBox, func=myList)
    # prendo come capogruppo la prima istanza
    gro = othe[0][0].get_group()
    for ele in othe[1:]:
        # imposto il capogruppo alle altre istanze
        ele[0].join_group(gro[0])
    # rendo attivo il button
    if type(valu) == type(1):
        othe[valu][0].set_active(True)
#myLabel
    if cLab == None:
        cLab = 'blue'
    #name='myLabel', leng=0, prea=' ', post='', font='Arial 10', colo=Gdk.color_parse('black')
    labe = myLabel(name=nLab,
                   leng=len(nLab) + 1,
                   prea=' ',
                   post=' ',
                   font='Courier 10',
                   colo=cLab)
    # inserisco la label nella list degli oggetti
    othe.insert(0, [labe])
    # inserisco la label in testa alla box
    #child, expand=True, fill=True, padding=0
    obje.pack_start(labe, False, False, 0)
    obje.reorder_child(labe, 0)
    # <-
    return obje, othe