Beispiel #1
0
    def __init__(self):
        super(LoginWidget, self).__init__()
        self.ui = Ui_Login()
        self.ui.setupUi(self)
        
        self.setLayout(self.ui.login_uiLayout)
        self.ui.Loginwidget.setLayout(self.ui.loginLayout)
        self.ui.Progresswidget.setLayout(self.ui.progressLayout)
        
        process.init()
        connect.init()
        
        self.connectSignals()
        self.jid = ""
        
        self.ui.hostipTxtbox.setText("127.0.0.1:8000")
        self.ui.xmppTxtbox.setText("*****@*****.**")
        self.ui.xmppVpnTxtbox.setText("public_server")
        
        # this is a quick-fix, remove completely afterwards
        self.ui.xmppPwTxtbox.hide()

        self.timer = QTimer()
        
        
        #generate new key for the session
        random_generator = Random.new().read
        self.key = RSA.generate(2048, random_generator)   
Beispiel #2
0
    def __init__(self):
        super(LoginWidget, self).__init__()
        self.ui = Ui_Login()
        self.ui.setupUi(self)

        self.setLayout(self.ui.login_uiLayout)
        self.ui.Loginwidget.setLayout(self.ui.loginLayout)
        self.ui.Progresswidget.setLayout(self.ui.progressLayout)

        process.init()
        connect.init()

        self.connectSignals()
        self.jid = ""

        self.ui.hostipTxtbox.setText("127.0.0.1:8000")
        self.ui.xmppTxtbox.setText("*****@*****.**")
        self.ui.xmppVpnTxtbox.setText("public_server")

        # this is a quick-fix, remove completely afterwards
        self.ui.xmppPwTxtbox.hide()

        self.timer = QTimer()

        #generate new key for the session
        random_generator = Random.new().read
        self.key = RSA.generate(2048, random_generator)
Beispiel #3
0
    def init(self):
        process.init()
        relay.initNet(config.data.u0addr)

        avg.ImageNode(href='background.png', parent=self._parentNode)

        engine.SoundManager.init(self._parentNode)

        self.registerState('Info', states.InfoState())
        self.registerState('Vote', states.VoteState())

        self.bootstrap('Info')
Beispiel #4
0
def getThreadAndName(init=True):
    thread = None
    name = None

    # Get thread from threading first, since if thread is set, then
    # we do not have to look up multiprocessing
    try:
        # compatible with Python 2.6+
        thread = threading.current_thread()
    except AttributeError:
        # compatible with Python 2.5- 
        thread = threading.currentThread()
    
    name = thread.getName()

    if name == 'MainThread':
        # This might be a multiprocess, thus multiprocessing must be checked
        p = None
        parent_pid = None
        try:
            p = multiprocessing.current_process()
            parent_pid = p._parent_pid
        except:
            pass

        if not parent_pid:
            # This is the main process!
            try:
                if thread.id:
                    name = thread.id
            except AttributeError:
                # Not initialised yet
                pass
        else:
            # p is a MultiProcess
            thread = p
            name = p.name

    try:
        if thread.id:
            pass
    except AttributeError:
        if init:
            # Engaging auto init
            import process
            process.init()

    return (thread, name)
Beispiel #5
0
def getThreadAndName(init=True):
    thread = None
    name = None

    # Get thread from threading first, since if thread is set, then
    # we do not have to look up multiprocessing
    try:
        # compatible with Python 2.6+
        thread = threading.current_thread()
    except AttributeError:
        # compatible with Python 2.5-
        thread = threading.currentThread()

    name = thread.getName()

    if name == 'MainThread':
        # This might be a multiprocess, thus multiprocessing must be checked
        p = None
        parent_pid = None
        try:
            p = multiprocessing.current_process()
            parent_pid = p._parent_pid
        except:
            pass

        if not parent_pid:
            # This is the main process!
            try:
                if thread.id:
                    name = thread.id
            except AttributeError:
                # Not initialised yet
                pass
        else:
            # p is a MultiProcess
            thread = p
            name = p.name

    try:
        if thread.id:
            pass
    except AttributeError:
        if init:
            # Engaging auto init
            import process
            process.init()

    return (thread, name)
Beispiel #6
0
def refresh():
    who.crawl(
    )  # Make sure WHO runs first, because we will be overwriting WHO data with localized sources

    europe.crawl()
    asia.crawl()
    usacases.crawl()
    econ.crawl()
    stocks.crawl()
    process.convert(
    )  # do the convertDict name replacements immediately after downloads finish

    process.init()
    process.bigCountries(
    )  # once bigdict is made, get all the countries where regional data is available
    process.status()
    color.crawl()  # dependent on status.csv
    process.toJSON()  # after everything is done convert to json
    process.customConfig()  # configure custom.json countries-in-one endpoint
    return "Success"
Beispiel #7
0
def manage():
    logging.basicConfig(filename='NoticeReminder.log',
                        format='[%(asctime)s] [%(levelname)s]: [%(message)s]',
                        datefmt='%Y-%m-%d %H:%M:%S',
                        level=logging.INFO)
    parser = argparse.ArgumentParser(description='Manage')
    parser.add_argument('-init',
                        action='store_true',
                        default=False,
                        help='init NoticeReminder')
    parser.add_argument('-run',
                        action='store_true',
                        default=False,
                        help='run NoticeReminder')

    args = parser.parse_args()
    if args.init:
        process.init()
    elif args.run:
        scheduler = BlockingScheduler()
        scheduler.add_job(main, "cron", hour="8-22",
                          minute="*/10")  # 8:00-23:00,每10分钟检测一次通知更新
        print('PROGRAM START')
        scheduler.start()
Beispiel #8
0
def main():
    vertices = process.init()  # points of the path [(x0, y0), (x1, y1), ...]
    vertices = np.array(vertices)
    endpoints = [0, len(vertices) - 1]

    def on_click(e):
        cur = np.array((e.xdata, e.ydata))
        dists = np.linalg.norm(vertices - cur, axis=1)
        p = np.argmin(dists)
        if e.button == 1:
            endpoints[0] = p
        elif e.button == 3:
            endpoints[1] = p

    plt.gcf().canvas.mpl_connect('button_press_event', on_click)

    while True:
        ret = process.read(debug=True)  # info of the car ((xt, yt), angle)
        if ret == -1:
            print('Something wrong happened ...')
            os._exit(0)
        # do something to move the car
        points = None
        p = None
        start, end = endpoints
        if start < end:
            points = vertices[start:end + 1]
            p = start + pos
        else:
            if end == 0:
                points = vertices[start::-1]
            else:
                points = vertices[start:end - 1:-1]
            p = start - pos
        plt.scatter([vertices[p][0]], [vertices[p][1]], c='r')
        plt.scatter([vertices[end][0]], [vertices[end][1]], c='g')
        plt.pause(0.01)
        finish = loop(points, ret)
        if finish:
            print('The end')
            break
    ser.close()
Beispiel #9
0
def init(collections, workspaceDir):
    process.init(collections)
    excel.init(workspaceDir)