예제 #1
0
    def __add_user(self, unused, radio, vbox):
        'adds a new user to the list'

        from auth import Auth
        Auth()
        gtk.main()
        from database import DataBase
        database = DataBase()
        users = database.get_username_and_password()
        current_users = [user.get_label() for user in vbox.get_children()[0].\
                         get_child().get_child().get_child().get_children()]
        for user in users:
            if str(user[0]) not in current_users:
                vbox.get_children()[0].get_child().get_child().get_child().\
                pack_start(gtk.RadioButton(radio, str(user[0])))
                from way2sms import login
                import thread
                thread.start_new_thread(login, (user[0], user[1], True))
        vbox.get_children()[0].get_child().get_child().get_child().show_all()
        return False
예제 #2
0
파일: sms.py 프로젝트: dibyendu/WayToSms
        self.thread = Thread(target = self._runner, args = (user, password))
        
    def start(self):
        self.thread.start()
        return
        
    def isAlive(self):
        return self.thread.isAlive()
    
    def getStatus(self):
        return self._login_status
        
    def _runner(self, user, password):
        return_value = login(user, password)
        self._login_status = (return_value != 'Network Error') and True or False
        return
        
gtk.gdk.threads_init()

database = DataBase()
if not database.has_default():
    from gui.auth import Auth
    Auth(True)
    gtk.main()
if database.has_default():
    login_thread_list = [LoginThread(user[0], user[1]) for user in database.get_username_and_password()]
    for thread in login_thread_list:
        thread.start()
    Interface(login_thread_list)
    gtk.main()
    sys.exit(0)