def createDetailedFrame(self):
        self.detailedFrame = LabelFrame(self.tk, text="挂号详情")
        self.detailedSelect = StringVar(self.detailedFrame)
        results = RegistrationtDAO.listByDoctor(self.doc.uid, False)
        results.sort(key=Registration.getRTime)
        self.detailedList = []
        for result in results:
            self.detailedList.append(doctorResultToString(result))
            out(doctorResultToString(result))
        self.detailedSelect.set(self.detailedList[0])
        self.detailedOption = OptionMenu(self.detailedFrame,
                                         self.detailedSelect,
                                         *self.detailedList,
                                         command=self.updateInfoFrame)
        self.detailedOption.config(width=43)
        self.detailedOption.grid(row=0, column=1, padx=5)

        self.createInfoFrame()

        self.doneButton = Button(self.detailedFrame,
                                 text="开始诊断",
                                 padx=10,
                                 command=self.doneHandler)
        self.doneButton.grid(row=2, column=0, columnspan=2)
        self.detailedFrame.grid(row=3, column=0)
Example #2
0
def run():
    merge.merge()
    out.out()
    ac = ASSR.AudioCorrection(
        'path.wav', 'tfSessions/2018-10-13-01:40:12-0.8486092/session.ckpt')
    ac.process()
    ac.saveCorrectedAudio()
    time.sleep(1)
    wit.wit()
    return 1
Example #3
0
    def userLogin(self, username, password):
        user = UserDAO.getByUsername(username)
        if user == None:
            out("[userLogin] Username not found", username)
            return None

        out("[userLogin] User:", user)

        if getSHA256(password) == user.hashPassword:
            return user

        return None
Example #4
0
 def loginResponce(self):
     out(f"[LOGIN] Username: {self.userName.get()}, Password: {self.password.get()}"
         )
     loginResult = self.userLogin(self.userName.get(), self.password.get())
     if (type(loginResult) == User):
         out(f"[LOGIN] Successful", loginResult)
         if (loginResult.utype == "doctor"):
             ui_doctor(loginResult.uid)
             return
         if (loginResult.utype == "patient"):
             ui_patient(loginResult.uid)
             return
     else:
         messagebox.showinfo("登陆失败", "请检查您的用户名和密码后,再试一次")
Example #5
0
 def updateMenus(self, *args):
     self.doctors = DoctorDAO.listByDepartment(self.getDepartment())
     self.doctors.sort(key=Doctor.getPrimaryKey)
     self.doctorsList = []
     for doctor in self.doctors:
         self.doctorsList.append(f"{doctor.uid}|{doctor.name}")
         out(f"{doctor.uid}|{doctor.name}")
     
     self.doctorOption.destroy()
     if(len(self.doctorsList) == 0):
         self.doctorsList.append("None")
     self.doctor.set(self.doctorsList[0])
     self.doctorOption = OptionMenu(self.tk, self.doctor, *self.doctorsList)
     self.doctorOption.config(width=20)
     self.doctorOption.grid(row=1, column=1, padx=5)
Example #6
0
def main(argv):
    try:
        if len(sys.argv) < 3:
            if sys.argv[1] == "-h" or sys.argv[1] == "--help":
                usage()
                sys.exit()
            else:
                clierror()
                sys.exit(2)
        else:
            if sys.argv[2] != "1" and sys.argv[2] != "2":  # check the input
                clierror()
                sys.exit(2)
            else:
                opts, args = getopt.getopt(argv, "so:pc",
                                           ["show", "ofile=", "post", "copy"])

        lyrics = Get.getlyrics(sys.argv[1], sys.argv[2])

    except getopt.GetoptError:
        print("error: missing a mandatory option.Use -h or --help for help")
        sys.exit(2)

    for opt, arg in opts:
        if opt in ("-s", "--show"):
            print(lyrics)
        elif opt in ("-o", "--ofile"):
            out.out(arg, lyrics)
        elif opt in ("-p", "--post"):
            try:
                for i in range(0, 100):
                    input(i + 1)
                    Post.post("♬" +
                              lyrics.splitlines()[i][11:].replace(" ", ""))
                    print("♬" + lyrics.splitlines()[i][11:].replace(" ", ""))
            except:
                print("输出完成")
        elif opt in ("-c", "--copy"):
            try:
                for i in range(1, 100):
                    Copy.inputtxt("♬" +
                                  lyrics.splitlines()[i][11:].replace(" ", ""))
                    print(lyrics.splitlines()[i][11:].replace(" ", ""))
                    input(i + 1)
            except:
                print("输出完成")
Example #7
0
def ParseCommandLine(d):
    d["-0"] = False     # 0-based sequences
    d["-d"] = 3         # Number of significant digits
    d["-e"] = True      # Include end point
    d["-n"] = True      # If True, include newline after number
    d["-s"] = False     # Use sig if True
    d["-t"] = False     # Run test cases
    d["-x"] = False     # Allow expressions
    d["name"] = os.path.split(sys.argv[0])[1]
    if len(sys.argv) < 2:
        Usage(d)
    try:
        optlist, args = getopt.getopt(sys.argv[1:], "0d:ehnstx")
    except getopt.GetoptError as e:
        msg, option = e
        out(msg)
        exit(1)
    for opt in optlist:
        if opt[0] == "-0":
            d["-0"] = True
        if opt[0] == "-d":
            try:
                d["-d"] = int(opt[1])
                if not (1 <= d["-d"] <= 15):
                    raise ValueError()
            except ValueError:
                msg = "-d option's argument must be an integer between 1 and 15"
                Error(msg)
        if opt[0] == "-e":
            d["-e"] = False
        if opt[0] == "-h":
            Usage(d, status=0)
        if opt[0] == "-n":
            d["-n"] = False
        if opt[0] == "-s":
            d["-s"] = True
        if opt[0] == "-t":
            d["-t"] = True
        if opt[0] == "-x":
            d["-x"] = True
    sig.digits = d["-d"]
    if not d["-t"] and len(args) not in range(1, 4):
        Usage(d)
    return args
    def createDetailedFrame(self):
        self.detailedFrame = LabelFrame(self.tk, text="挂号详情")
        self.detailedSelect = StringVar(self.detailedFrame)
        results = RegistrationtDAO.listByPatient(self.patient.uid, False)
        results.sort(key=Registration.getRTime)
        self.detailedList = []
        for result in results:
            self.detailedList.append(patientResultToString(result))
            out(patientResultToString(result))
        self.detailedSelect.set(self.detailedList[0])
        self.detailedOption = OptionMenu(self.detailedFrame,
                                         self.detailedSelect,
                                         *self.detailedList,
                                         command=self.updateInfoFrame)
        self.detailedOption.config(width=43)
        self.detailedOption.grid(row=0, column=1, padx=5)

        self.createInfoFrame()

        self.detailedFrame.grid(row=3, column=0)
Example #9
0
def FloatingPoint(n, m, inc, d):
    fmt = "%%.%dg" % d["-d"]
    for i in frange(n, m, inc, include_end=d["-e"]):
        if i <= float(m):
            if d["-s"]:
                out(sig(i), "", nl=d["-n"])
            else:
                out(fmt % i, "", nl=d["-n"])
    if not d["-n"]:
        out()
Example #10
0
def main():
    desired_year = time.gmtime()[0]  # Default to current year
    if len(sys.argv) > 1:
        desired_year = int(sys.argv[1])
    # Get a list of the phase times in Julian days.  Each element of the
    # list is another list containing the Julian day and the phase number.
    results, zn = [], zone_name
    new   = GetPhaseData(desired_year, NEW)
    first = GetPhaseData(desired_year, FIRST)
    full  = GetPhaseData(desired_year, FULL)
    last  = GetPhaseData(desired_year, LAST)
    FixArrays(new, first, full, last)
    indent = " " * 12
    out('''
                    Moon phases for {desired_year}
          (Times are {zn} time corrected for DST)'''[1:].format(**locals()))
    out('''
      New             Full          First Qtr       Last Qtr
  ------------    ------------    ------------    ------------
'''[:-1])
    fmt = "%-15s "
    for i in range(len(new)):
        out(fmt % GetItem(new[i]), nl=0)
        out(fmt % GetItem(full[i]), nl=0)
        out(fmt % GetItem(first[i]), nl=0)
        out(fmt % GetItem(last[i]))
Example #11
0
def Usage(d, status=1):
    name = d["name"]
    digits = d["-d"]
    out(__doc__.strip().format(**locals()))
    sys.exit(status)
Example #12
0
def Error(msg, status=1):
    out(msg, stream=sys.stderr)
    exit(status)
Example #13
0
def ShowExamples(d):
    '''Print some examples.
    '''
    d["-n"] = False
    f = "%-20s "
    out("Output for various command line arguments:\n")
    #
    out(f % "'-n 8'  ", nl=0)
    Integers(1, 8, 1, d)
    #
    out(f % "'-n -e 8'  ", nl=0)
    d["-e"] = False
    Integers(1, 8, 1, d)
    d["-e"] = True
    #
    out(f % "'-n -0 8'  ", nl=0)
    Integers(0, 8, 1, d)
    #
    d["-e"] = False
    out(f % "'-n -0 -e 8'  ", nl=0)
    Integers(0, 8, 1, d)
    d["-e"] = True
    #
    out()
    out(f % "'-n 0 1 1/8'  ", nl=0)
    Fractions(0, 1, "1/8", d)
    #
    out(f % "'-n -e 0 1 1/8'  ", nl=0)
    d["-e"] = False
    Fractions(0, 1, "1/8", d)
    d["-e"] = True
    #
    out()
    out(f % "'-n 1 6 0.75'  ", nl=0)
    FloatingPoint(1, 6, "0.75", d)
    #
    out(f % "'-n 1 6 3/4'  ", nl=0)
    Fractions(1, 6, "3/4", d)
    #
    out(f % "'-n -e 1 6 0.75'  ", nl=0)
    d["-e"] = False
    FloatingPoint(1, 6, "0.75", d)
    d["-e"] = True
    #
    out(f % "'-n -e 1 6 3/4'  ", nl=0)
    d["-e"] = False
    Fractions(1, 6, "3/4", d)
    d["-e"] = True
    #
    out(f % "'-n -s 1 6 0.75'  ", nl=0)
    d["-s"] = False
    FloatingPoint(1, 6, "0.75", d)
    d["-s"] = True
    exit(0)
Example #14
0
def Integers(n, m, inc, d):
    for i in frange(n, m, inc, return_type=int, include_end=d["-e"]):
        if i <= int(m):
            out(i, "", nl=d["-n"])
    if not d["-n"]:
        out()
Example #15
0
def Fractions(n, m, inc, d):
    for i in frange(n, m, inc, impl=R, return_type=R, 
                    include_end=d["-e"]):
        out(i, "", nl=d["-n"])
    if not d["-n"]:
        out()
Example #16
0
#!/bin/python3

from simulated_annealing import simulated_annealing, target_function, calculate_nutrients
from config import CONFIG, generate_nutrient_functions
from meal_parser import MealParser
from out import out

if __name__ == '__main__':
    FOOD_PARSER = MealParser(CONFIG['FILE_NAME'])
    FOOD = FOOD_PARSER.read_meals_from_file()
    config = generate_nutrient_functions(CONFIG, CONFIG['NUTRIENTS_WEIGHTS'],
                                         CONFIG['GOAL'])
    BEST_DIET = simulated_annealing(config['DAYS_OF_DIET'], config['GOAL'],
                                    FOOD, config)
    out(FOOD, BEST_DIET, [g * config['DAYS_OF_DIET'] for g in config['GOAL']],
        target_function(BEST_DIET, config['GOAL'], FOOD, config), config)