Example #1
0
class FirefoxConnection(object):
    def __init__(self):
        self.connected = None
        self.loop = MainLoop(protocol_map, self.poke)

    def poke(self):
        print "poking!"
        sublime.set_timeout(self.loop.process, 0)

    def connect(self):
        return defer.maybeDeferred(self._connect)

    def _connect(self):
        if self.connected:
            return self.connected

        # XXX: grab port and hostname from settings maybe?
        self.connected = connect()
        self.connected.addCallback(self._connected)

        self.loop.start()

        return self.connected

    def _connected(self, client):
        print "setting connected to %s" % (self.client,)
        self.client = client
        self.connected = client

    @defer.deferredGenerator
    def choose_tab(self, *args):
        print "choosing tab!"
        d = defer.waitForDeferred(self.client.root.list_tabs())
        yield d
        tabs = d.getResult()
        yield tabs["tabs"][tabs["selected"]]
Example #2
0
    def LogIn(event):
        flag=0

        connection = Database.DatabaseConnectionError();
        cursor = connection.cursor()
         
        t_password=ent_password.get()
        t_name=ent_name.get()
         
        sql_select_Query = "select * from users"
        cursor.execute(sql_select_Query)
        records=cursor.fetchall()
                
        for row in records:
            if row[1]==t_name and row[2]==t_password:
                flag=1
        if flag==1:
            root.destroy()
            MainLoop.MainEvent()
        l_r.set("Wrong Password or Username")
Example #3
0
def background_process():
    MainLoop.runMain()
    MainLoop.flag = True
    return ""
Example #4
0
 def __init__(self):
     self.connected = None
     self.loop = MainLoop(protocol_map, self.poke)
Example #5
0
 def __init__(self):
     print "Init Main object for CamDevice..."
     self._mainLoop=MainLoop.MainLoop()
from imports import *

import Load
import MainLoop as ml


Load.LoadPro()

while True:
    try:
        ml.MainLoop()
    except:
        print('application closed')
        exit(0)
Example #7
0
skull.addAliases("skull")
bunker.addItem(alter)
surface.addItem(skull)

Game.curRoom = bunker


def process():
    result = Game.result
    cmd = Game.cmd
    if cmd[0] == "put":
        if result == 1 and cmd[1] == skull and cmd[2] == alter:
            Game.say("The Alter hums with a strange power.")
            alter.desc = "The time is now. Activate The Alter, and finish this."
            Game.states["alterReady"] = True
    if cmd[0] == "use":
        print("using")
        if result == Game.states["alterReady"] and cmd[1] == alter or cmd[
                2] == alter:
            Game.say("You awake with a start in your bed.")
            Game.curRoom = bedRoom


print(Game.prompt)
while True:
    MainLoop.run()
    process()
    Game.result = -1
    Game.cmd = [""]
    print(Game.prompt)
Example #8
0
def loop():
    from async import MainLoop
    l = MainLoop(protocol_map)
    l.start()
    l.block()
Example #9
0
 def __init__(self):
     print "Init Main object..."
     #Size of application window
     self.dwidth = 800
     self.dheight = 600
     self._mainLoop = MainLoop.MainLoop()
Example #10
0
            os.system('sudo rm /var/run/wpa_supplicant/p2p-dev-wlan0')

            wpsresult = os.popen('sudo wpa_cli wps_pbc').read(
            )  # try to use wps push button mode
            if wpsresult.find('p2p') == -1:
                return True
            else:
                return False

    def WpsConnectionCheck(self, context):
        print " Checking connection...."
        connected = context._binDisplay.showWiFiConnectionProgress()
        return connected


if __name__ == '__main__':
    import MainLoop
    context = MainLoop.MainLoop()
    context.initialize()

    print "Testcode for WiFi"
    wifi = WiFi()
    if wifi.WpsConnectStart():
        print "Press WPS on  router"
        if wifi.WpsConnectionCheck(context):
            print "Connected"
        else:
            print "WPS Connection FAILED"
    else:
        print "WPS PBC FAILED"