def atk_acc(objeto, etiqueta): ''' Este metodo es utilizado para relacionar una etiqueta a un objeto como \ por ejemplo Botones y Deslizadores etc. ''' atk_obj = objeto.get_accessible() atk_l = etiqueta.get_accessible() relation_set = atk_l.ref_relation_set() relation = atk.Relation((atk_obj,), atk.RELATION_LABEL_FOR) relation_set.add(relation)
#!/usr/bin/env python import gtk import atk import hildon win = hildon.Window() win.connect('destroy', lambda win: gtk.main_quit()) button = gtk.Button(stock=gtk.STOCK_QUIT) button.connect('pressed', lambda button: gtk.main_quit()) atk_button = button.get_accessible() atk_button.set_description('Be careful, clicking this button will exit') label = gtk.Label('This label describes a button') atk_label = label.get_accessible() atk_label.set_description('This is a useless label') relation_set = atk_label.ref_relation_set() relation = atk.Relation((atk_button, ), atk.RELATION_LABEL_FOR) relation_set.add(relation) box = gtk.HBox() box.pack_start(label) box.pack_start(button) win.add(box) win.show_all() gtk.main()
def __init__(self, builder): '''Initialize the User Screen class''' super(UserScreen, self).__init__(builder) self.name = "User Screen" self.saved_msg = None self.validation_occurring = False self.saved_msg_type = None self.user_name = self.builder.get_object("usernameentry") self.login_name = self.builder.get_object("loginnameentry") self.password = self.builder.get_object("userpassword1entry") self.verify = self.builder.get_object("userpassword2entry") self.hostname = self.builder.get_object("hostnameentry") self.loginnameinfoimage = self.builder.get_object("loginnameinfoimage") self.loginnameinfolabel = self.builder.get_object("loginnameinfolabel") self.userpasswordinfoimage = self.builder.get_object( "userpasswordinfoimage") self.userpasswordinfolabel = self.builder.get_object( "userpasswordinfolabel") self.hostnameinfoimage = self.builder.get_object("hostnameinfoimage") self.hostnameinfolabel = self.builder.get_object("hostnameinfolabel") loginnamelabel = self.builder.get_object("loginnamelabel") userpasswordlabel1 = self.builder.get_object("userpassword1label") userpasswordlabel2 = self.builder.get_object("userpassword2label") userpasswordentry = self.builder.get_object("userpassword2entry") hostnamelabel = self.builder.get_object("hostnamelabel") if None in [ self.user_name, self.login_name, self.password, self.verify, self.hostname, self.loginnameinfoimage, self.loginnameinfolabel, self.userpasswordinfoimage, self.userpasswordinfolabel, self.hostnameinfoimage, self.hostnameinfolabel, loginnamelabel, userpasswordlabel1, userpasswordlabel2, userpasswordentry, hostnamelabel ]: modal_dialog(_("Internal error"), GLADE_ERROR_MSG) raise RuntimeError(GLADE_ERROR_MSG) # Setup Accessibility relationship for the loginname atk_loginnamelabel = loginnamelabel.get_accessible() self.atk_loginnameinfolabel = self.loginnameinfolabel.get_accessible() atk_parent = self.login_name.get_accessible() relation_set = atk_parent.ref_relation_set() relation = atk.Relation(( atk_loginnamelabel, self.atk_loginnameinfolabel, ), atk.RELATION_LABELLED_BY) relation_set.add(relation) # Setup Accessibility relationship for the password self.atk_passwordinfolabel = \ self.userpasswordinfolabel.get_accessible() atk_userpasswordlabel = userpasswordlabel1.get_accessible() atk_parent = self.password.get_accessible() relation_set = atk_parent.ref_relation_set() relation = atk.Relation(( atk_userpasswordlabel, self.atk_passwordinfolabel, ), atk.RELATION_LABELLED_BY) relation_set.add(relation) atk_userpasswordlabel = userpasswordlabel2.get_accessible() atk_parent = userpasswordentry.get_accessible() relation_set = atk_parent.ref_relation_set() relation = atk.Relation(( atk_userpasswordlabel, self.atk_passwordinfolabel, ), atk.RELATION_LABELLED_BY) relation_set.add(relation) # Setup Accessibility relationship for the hostname self.atk_hostnameinfolabel = self.hostnameinfolabel.get_accessible() atk_hostnamelabel = hostnamelabel.get_accessible() atk_parent = self.hostname.get_accessible() relation_set = atk_parent.ref_relation_set() relation = atk.Relation(( atk_hostnamelabel, self.atk_hostnameinfolabel, ), atk.RELATION_LABELLED_BY) relation_set.add(relation)