示例#1
0
    def display_sign_off(self):
        """(Window) -> NoneType
        Helper function to display the sign off info.
        """
        rounds = ""
        for i in range(int(self.vars[1].get())):
            rounds += "     Round " + str(i + 1)
        rounds += '     Remove?'

        l1 = tk.Label(self, text="Dancer Number" + rounds, font=label_font)
        l1.place(x=10, y=80)

        # Get marks from AutoAssist
        assist_marks = run(self.pic_names[self.count], int(self.vars[1].get()))

        # Dancer Numbers
        nums = list()
        for i in range(len(assist_marks)):
            nums.append(tk.StringVar())
            e = tk.Entry(self, width=15, textvariable=nums[-1])
            e.place(x=14, y=110 + 20 * i)
            e.insert(0, str(assist_marks[i][0]))

        marks = list()
        for i in range(int(self.vars[1].get())):
            items = list()
            # Marks for Round i + 1
            for j in range(len(assist_marks)):
                # Assume any number found greater than 100 is a decimal to simplify our vision complexity.
                if assist_marks[j][i + 1] > 100:
                    str_curr = str(assist_marks[j][i + 1])
                    assist_marks[j][i + 1] = float(str_curr[:2] + '.' +
                                                   str_curr[2])
                items.append(tk.StringVar())
                e = tk.Entry(self, width=10, textvariable=items[-1])
                e.place(x=143 + 78 * i, y=110 + 20 * j)
                e.insert(0, str(assist_marks[j][i + 1]))
                # Insert the NULLIFY button
                if i + 1 == int(self.vars[1].get()):
                    self.checks.append(tk.IntVar())
                    c = tk.Checkbutton(self, variable=self.checks[-1])
                    c.place(x=400, y=107 + 20 * j)

            marks.append(items)

        # Setup all of the judge's marks.
        for i in range(len(nums)):
            dancer_marks = list()
            for k in range(len(marks)):
                dancer_marks.append(marks[k][i])
            self.judge.append([nums[i]] + dancer_marks)
示例#2
0
def ws_receive(meta, wss, txt):
    global mainthread, pre_stix
    if txt.startswith("NOTENC"):
        data = txt.split(':::')[1:]
        try:
            if data[0] == "START":
                data = json.loads(data[1])
                res = {}
                for name in data['used']:
                    cur = data[name]
                    if type(cur) == list:
                        res[name] = list(
                            map(lambda x: x['norm']
                                if 'norm' in x else x, cur))
                    else:
                        res[name] = {}
                        for x, y in cur.items():
                            res[name][x] = list(
                                map(lambda j: j['norm']
                                    if 'norm' in j else j, y))
                    if res[name] == {} or res[name] == []:
                        res.pop(name)
                mainthread = StoppableThread(lambda: run(res, callback))
                mainthread.start()
            elif data[0] == "STOP":
                callback.toast_red("Сканирование",
                                   "Сканирование закончено вручную")
                mainthread.stop()
            elif data[0] == "GETSTIX":
                if pre_stix:
                    callback.stixparse(pre_stix)
                pre_stix = None
            elif data[0] == "POWEROFF":
                sleep(5)
                kill()
        except Exception as e:
            print(e)
    else:
        data = enc.decrypt(bytes(txt, 'utf-8', ""))
        set_cred(data)
示例#3
0
#!/usr/bin/env python

from Main import run

run()
示例#4
0
def main():
    raw_text = run('banana')
    print(raw_text + '\n\n')
    s = summarize(raw_text)
    for i in range(len(s)):
        print(s[i])