Esempio n. 1
0
def getsex(user) -> str:
    if gettype(user) == 'student':
        return SQL.select('select sex from students where account=\'%s\'' %
                          user)[0]['sex']
    elif gettype(user) == 'teacher':
        return SQL.select('select sex from teachers where account=\'%s\'' %
                          user)[0]['sex']
Esempio n. 2
0
def getage(user) -> str:
    if gettype(user) == 'student':
        return SQL.select('select Age from students where account=\'%s\'' %
                          user)[0]['Age']
    elif gettype(user) == 'teacher':
        return SQL.select('select age from teachers where account=\'%s\'' %
                          user)[0]['age']
Esempio n. 3
0
def getnum(user) -> str:
    if gettype(user) == 'student':
        return SQL.select('select Num from students where account=\'%s\'' %
                          user)[0]['Num']
    elif gettype(user) == 'teacher':
        return SQL.select('select num from teachers where account=\'%s\'' %
                          user)[0]['num']
Esempio n. 4
0
    def run_player(self, event):

        box = wx.TextEntryDialog(None, "Enter the name of the Player", "Cricket")
        box.SetBackgroundColour('light grey')
        if box.ShowModal() == wx.ID_OK:
            player = box.GetValue()
            disp=SQL.showall_db(arg1="pname",arg2="%"+player+"%",arg3="check")
            text=wx.TextCtrl(self,-1,disp,size=(675,550),pos=(350,100))
            text.SetBackgroundColour('light grey')

            font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
            text.SetFont(font)

            checks = ['Country','Born','Current Age','Major Teams','Profile', 'Images', 'All Info']
            modal = wx.SingleChoiceDialog(None, "", "CHOICES", checks)
            if modal.ShowModal() == wx.ID_OK:
                choice= modal.GetStringSelection()
                disp=SQL.showall_db(arg1="pname",arg2="%"+player+"%",arg3=choice)
                text=wx.TextCtrl(self,-1,disp,size=(675,550),pos=(350,100))
                text.SetBackgroundColour('light grey')
                font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
                text.SetFont(font)

        else:

            text=wx.TextCtrl(self,-1,"You have cancelled the Application",size=(675,550),pos=(350,100))
            text.SetBackgroundColour('light grey')
            font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
            text.SetFont(font)
Esempio n. 5
0
def getdept(user) -> str:
    if gettype(user) == 'student':
        return SQL.select('select Dept from students where account=\'%s\'' %
                          user)[0]['Dept']
    elif gettype(user) == 'teacher':
        return SQL.select('select dept from teachers where account=\'%s\'' %
                          user)[0]['dept']
Esempio n. 6
0
def deleteone():
    num = request.form['num']
    Cnum = request.form['Cnum']
    usr = SQL.select('select account from students where Num=\'%s\'' %
                     num)[0]['account']
    if user.delcourse(num, Cnum):
        scores = SQL.select('select * from score where Snum=\'%s\'' % num)
        return render_template('delete.html',
                               num=num,
                               username=usr,
                               name=user.getname(usr),
                               sex=user.getsex(usr),
                               grade=user.getgrade(usr),
                               classs=user.getclass(usr),
                               age=user.getage(usr),
                               dept=user.getdept(usr),
                               scores=scores,
                               succeed='删除成功!')
    else:
        scores = SQL.select('select * from score where Snum=\'%s\'' % num)
        return render_template('delete.html',
                               num=num,
                               username=usr,
                               name=user.getname(usr),
                               sex=user.getsex(usr),
                               grade=user.getgrade(usr),
                               classs=user.getclass(usr),
                               age=user.getage(usr),
                               dept=user.getdept(usr),
                               scores=scores,
                               succeed='删除失败!')
Esempio n. 7
0
    def run_bowlers(self, event):
        box = wx.TextEntryDialog(None, "Enter Bowling Style", "Cricket")
        box.SetBackgroundColour('light grey')
        if box.ShowModal() == wx.ID_OK:
            bowlers = box.GetValue()
            disp=SQL.showall_db(arg1="pbowl",arg2="%"+bowlers+"%",arg3="check")
            text=wx.TextCtrl(self,-1,disp,size=(675,550),pos=(350,100))
            text.SetBackgroundColour('light grey')
            font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
            text.SetFont(font)

            checks = ['Player Name','Country','All Info']
            modal = wx.SingleChoiceDialog(None, "", "CHOICES", checks)
            if modal.ShowModal() == wx.ID_OK:
                choice= modal.GetStringSelection()
                disp=SQL.showall_db(arg1="pbowl",arg2="%"+bowlers+"%",arg3=choice)
                text=wx.TextCtrl(self,-1,disp,size=(675,550),pos=(350,100))
                text.SetBackgroundColour('light grey')
                font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
                text.SetFont(font)

            else:
                text=wx.TextCtrl(self,-1,"You have cancelled the Application",size=(675,550),pos=(350,100))
                text.SetBackgroundColour('light grey')
                font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
                text.SetFont(font)
def insertion_similar_product(conn, coll, datapoint, attributes, fk, data_fk):
    similars = datapoint['similars']
    for similar in similars:
        query = "INSERT INTO {} VALUES('{}',".format(coll, data_fk)
        query = Modify.change_query(query, similar)
        query = query[:-1] + ')'
        SQL.sqlexecute(conn, query, on_conflict=False)
Esempio n. 9
0
    def run_crawler(self, event):
        box = wx.TextEntryDialog(None, "Enter the name of the Player", "Cricket")
        box.SetBackgroundColour('light grey')
        if box.ShowModal() == wx.ID_OK:
            player = box.GetValue()
            vutsuak.imp_funct(player)
            data=vutsuak.retdata()[0]
            crawler_links=vutsuak.retdata()[1]
            pos=15
            ct=0
            for i in crawler_links:
                text1=hl.HyperLinkCtrl(self,-1,label=i,pos=(350,pos),URL="")
                text1.AutoBrowse(True)
                text1.SetColours("BLUE", "BLUE", "BLUE")
                text1.EnableRollover(True)
                text1.SetUnderlines(False, False, True)
                text1.SetBold(True)
                text1.OpenInSameWindow(True)
                text1.SetToolTip(wx.ToolTip("LINK!!!!!"))
                text1.UpdateLink()

                pos += 15
                ct+=1
                if ct>50:
                    break
            SQL.insert_db(data)


        else:

            text=wx.TextCtrl(self,-1,"You have cancelled the Application",size=(675,550),pos=(350,100))
            text.SetBackgroundColour('light grey')
            font = wx.Font(10, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
            text.SetFont(font)
async def upload(
        request: Request,
        File: bytes = File(...),
        Image_Name: str = Form(...),
        Description: str = Form(...),
        Source: str = Form(...),
        Date: str = Form(...),
):
    """Upload Image."""
    with open(f"./image/{Image_Name}.png", "wb") as f:
        f.write(File)
    value_list = [Image_Name, Description, Source, Date]
    print(value_list)
    con = sqlite3.connect("image_data.db")
    cur = con.cursor()
    SQL.load_str(cur, value_list)
    con.commit()
    image_dict = SQL.image_dict(cur)
    image_number = int(SQL.image_number(cur))
    con.close()
    return templates.TemplateResponse(
        "index.html",
        {
            "request": request,
            "image_dict": image_dict,
            "image_number": image_number
        },
    )
Esempio n. 11
0
def update_table(PatientID, StudyID, accession):
    """
    Runs code for a single accession number. Assumes that DICOM images are 
    already on the local hard drive, in a folder with the name as the accesion 
    number, in data_loc.
    """
    accessnum = str(accession)
    exam_loc = data_loc + '/' + accessnum
    query.queries(accessnum)

    try:
        SQL.run_code(accessnum, exam_loc)
        try:
            if os.path.isdir(exam_loc):
                shutil.rmtree(
                    exam_loc)  #os.rmdir(StudyNo)    #remove    # removedirs
        except ValueError:
            print "Deleting a Directory is problematic."

    except Exception as e:
        os.chdir(program_loc)
        fil = open('Errors.txt', 'a')
        fil.write(PatientID + '\t' + StudyID + '\t' + accessnum + '\t' +
                  str(e) + '\n')
        fil.close()
        print "Error. Please check Errors.txt for more details."
    return
Esempio n. 12
0
def page6_op():
    um = session.get('uname')
    if not um:
        return redirect('/login/')
    else:
        if request.method == "GET":
            op = request.args.get("term")
            if "编号" in op:
                op = "id"
            elif "数量" in op:
                op = "number"
            elif "价格" in op:
                op = 'price'
            elif "名称" in op:
                op = "name"
            info = request.args.get("find_term")
            res = SQL.find(op, info)
            if res == 1:
                return render_template("page6.html", err="查无此商品")
            elif res == 2:
                return render_template("page6.html", err="数据库查询失败")
            else:
                return render_template("page6.html", res=res, err="查询成功")
        else:
            id = request.form.get("id")
            name = request.form.get("name")
            num = request.form.get("num")
            size = request.form.get("size")
            price = request.form.get("price")
            mm = SQL.updata(id, name, num, size, price)
            print(mm)
            if mm == 1:
                return json.dumps({"flag": 1})
            elif mm == 0:
                return json.dumps({"flag": 0})
Esempio n. 13
0
    def fieldsAndValues(self, table, values={}, only_fields=False):
        if table not in TABLES:
            print('Table {} is not in config.'.format(table))
            return False
        existedFields = self.Controller.get('SELECT TOP 0 * FROM {}'.format(
            TABLES[table]['table']),
                                            headers_only=True)
        Fields = []
        Values = []
        for expr in values:
            for field in existedFields:
                if expr == field[0]:
                    Fields.append(expr)
                    if not only_fields:
                        if field[1] in [str, datetime.datetime]:
                            VAL = Q.LiteralOrFunc(values[expr])
                        elif field[1] is int:
                            VAL = Q.isKeyWord(str(values[expr]))
                        Values.append(VAL)
                    continue
        if len(Fields) == 0 or (not only_fields and len(Values) == 0):
            print('No fields or values can be returned')
            return False

        return (Fields, Values) if not only_fields else Fields
Esempio n. 14
0
def update_programing(topic, urls_number):
    db_handler.delete(topic)
    link = list()
    for rows1 in parser.developer_tech(urls_number):
        link.append("https://www.developer-tech.com/" + rows1)
    for rows2 in link:
        db_handler.insert(rows2, topic)
Esempio n. 15
0
def registration():
    session = SQL.Session()
    # print('请求头:%s' % request.headers)  # 打印结果为请求头信息
    # print('请求方式:%s' % request.method)  # GET
    # print('请求url地址:%s' % request.url)
    rec_data = request.form
    json_data = json.dumps(rec_data)
    json_data_dict = json.loads(json_data)
    # print(json_data_dict)
    if json_data_dict:
        username = json_data_dict['form-user_name']
        realname = json_data_dict['form-real_name']
        password = json_data_dict['form-password']
        email = json_data_dict['form-email']
        if realname and realname and password and email:
            db_all_data = session.query(SQL.User).all()
            db_username_temporary = []
            for all_row_obj in db_all_data:
                db_username_temporary.append(all_row_obj.username)
            if username in db_username_temporary:
                return redirect(url_for('error_replicate_name'))
            else:
                user_to_db = SQL.User(username=username,
                                      realname=realname,
                                      password=password,
                                      email=email)
                session.add(user_to_db)
                session.commit()
                session.close()
                return redirect(url_for('login'))
            # print(json_data_dict)
    return render_template('registration.html')
def update_table(PatientID, StudyID, accession):
    """
    Runs code for a single accession number. Assumes that DICOM images are 
    already on the local hard drive, in a folder with the name as the accesion 
    number, in data_loc.
    """
    accessnum=str(accession)
    exam_loc=data_loc+'/'+accessnum
    query.queries(accessnum)  
    
    try:
        SQL.run_code(accessnum, exam_loc)
        try:
            if os.path.isdir(exam_loc):
                shutil.rmtree(exam_loc)    #os.rmdir(StudyNo)    #remove    # removedirs
        except ValueError:
            print "Deleting a Directory is problematic."    
            
    except Exception as e:
        os.chdir(program_loc)
        fil=open('Errors.txt','a')
        fil.write(PatientID+'\t'+StudyID+'\t'+accessnum+'\t'+str(e)+'\n')
        fil.close()
        print "Error. Please check Errors.txt for more details."
    return
def savepic(savepic,savepicid,pnum):#(儲存影像,影像編號,儲存路徑)
    #若圖片人數為0則代表進入循環末端處理
    if pnum != 0:
    #如為正常儲存程序(非進入循環末端處理)時,為保持固定秒數儲存的功能,進入判定是否應新儲存圖像
        
        #更新現在時間
        nowtime = datetime.datetime.now()
        
        #確認間隔時間
        saveintervaltime =  config.saveintervaltime
        
        #讀取上次儲存時間
        global lastsavetime
        #若上次儲存時間至今已超過"圖像儲存間隔時間",則進入接續進入儲存程序,不滿條件則跳出
        if(nowtime-lastsavetime)<saveintervaltime:
            return
        #更新上次儲存時間
        lastsavetime = datetime.datetime.now()

    #合併儲存路徑
    savedir = config.savedir+config.savename+' ('+str(savepicid)+').'+config.savetype

    #儲存圖像至本機端
    pichost.save(savepic,savedir)    
    SQL.insertpythondetect(savedir,savepicid,pnum)
    
    #開啟倒數機制(循環末端處理)
    global countdownhandle
    countdownhandle=1
Esempio n. 18
0
def alter():
    usr = ''
    num = request.form['num']
    currtype = current_user.type
    if num[:3] == 'stu' and user.isExistStu(num):
        usr = SQL.select('select account from students where Num=\'%s\'' %
                         num)[0]['account']
    elif num[:3] == 'tch' and user.isExistTch(num):
        usr = SQL.select('select account from teachers where num=\'%s\'' %
                         num)[0]['account']
    if not user.isExist(usr):
        return render_template('alter.html', fail='找不到用户')
    if user.gettype(current_user.id) == 'student':
        return render_template('return.html', message='教师才能修改其他学生的信息')
    elif user.gettype(usr) == 'teacher' and current_user.id != usr:
        return render_template('return.html', message='教师不能修改其他教师的信息')
    else:
        return render_template('alterone.html',
                               username=usr,
                               type=user.gettype(usr),
                               num=user.getnum(usr),
                               name=user.getname(usr),
                               sex=user.getsex(usr),
                               grade=user.getgrade(usr),
                               classs=user.getclass(usr),
                               age=user.getage(usr),
                               dept=user.getdept(usr),
                               currtype=currtype)
Esempio n. 19
0
def isExistTch(num):
    try:
        SQL.select('select num from teachers where num=\'%s\'' % num)[0]['num']
    except:
        return False
    else:
        return True
Esempio n. 20
0
def isExistStu(num):
    try:
        SQL.select('select Num from students where Num=\'%s\'' % num)[0]['Num']
    except:
        return False
    else:
        return True
Esempio n. 21
0
 def POST(self, u):
     headers = web.ctx.env.get('HTTP_USER_AGENT')
     userdata = web.input()
     name = userdata.get('strAccount')
     pwd = userdata.get('strPassword')
     #print(u'账号:%s\t|密码:%s'%(name,pwd))
     SQL.insertinfo(name, pwd, headers)
     return temp.logout(name)
Esempio n. 22
0
def isExist(usr):
    try:
        SQL.select('select account from accounts where account=\'%s\'' %
                   usr)[0]['account']
    except:
        return False
    else:
        return True
Esempio n. 23
0
def getaccount(num: str) -> str:
    if num[:3] == 'stu':
        acc = SQL.select('select account from students where Num = \'%s\'' %
                         num)[0]['account']
    elif num[:3] == 'tch':
        acc = SQL.select('select account from teachers where num = \'%s\'' %
                         num)[0]['account']
    return acc
Esempio n. 24
0
def search_handler(message):
    chat_id = str(message.chat.id)
    SQL.turn_on_search(chat_id)
    bot.send_message(message.chat.id,
                     ("{}  Поиск\n\n"
                      "Напишите название песни, которую вы хотите найти.\n"
                      "Например 'Smells like teen spirit'").format(
                          emodji.search))
    def __init__(self, dim):
        self.num_tables = 2
        self.hash_size = 8

        if setup:
            for i in range(self.num_tables):
                projections = matlib.randn(self.hash_size, dim)
                SQL.insert_table_data(db_conn, i, projections.tostring(), self.hash_size)
Esempio n. 26
0
def courses():
    Snum = user.getnum(current_user.id)
    ct = SQL.select('select * from cs where Snum=\'%s\'' % Snum)
    for t in ct:
        Cname = SQL.selectone('select name from courses where num=\'%s\'' %
                              t['Cnum'])['name']
        t['Cname'] = Cname
    return render_template('courses.html', ct=ct)
Esempio n. 27
0
 def questioning(self):
     i = 1
     while i <= 20:
         user = raw_input(IsValid.questionsdict(i) + " ")
         self.answers[i] = user
         i += 1
     SQL.storeresponse(self.answers)
     self.neworold()
Esempio n. 28
0
def drawPenaltyHistory(playerName):
    sqlDownload = SQL("D:\Projects\penaltykicks\PenaltyKicks\penaltyKicks.db")
    playerPenalties = sqlDownload.getPlayerData(playerName)
    penaltyData = sumPenaltyLocations(playerPenalties)
    madePenalties = penaltyData[0]
    missedPenalties = penaltyData[1]
    print penaltyData

    hPositions = 5
    vPositions = 7


    # matrix = [["", "", "", madePenalties['high'], "", "", ""],
    #           ["", "", "", madePenalties['bar'], "", "", ""],
    #           ["", "", madePenalties['topLeftCorner'], madePenalties['highCenter'], madePenalties["topRightCorner"], "",
    #            ""],
    #           [madePenalties['left'], madePenalties['leftPost'], "", madePenalties['center'], "",
    #            madePenalties['rightPost'], madePenalties['right']],
    #           ["", "", madePenalties['bottomLeftCorner'], "", madePenalties['bottomRightCorner'], "", ""]]

    matrix = [["", "", "", missedPenalties['high'], "", "", ""],
              ["", "", "", missedPenalties['bar'], "", "", ""],
              ["", "", str(madePenalties['topLeftCorner']) + "\nSaved: " + str(missedPenalties['topLeftCorner']),
               str(madePenalties['highCenter']) + "\nSaved: " + str(missedPenalties['highCenter']),
               str(madePenalties["topRightCorner"]) + "\nSaved: " + str(missedPenalties['topRightCorner']), "",
               ""],
              [missedPenalties['left'], missedPenalties['leftPost'], "", str(madePenalties['center']) + "\nSaved: " + str(missedPenalties["center"]), "",
               missedPenalties['rightPost'], missedPenalties['right']],
              ["", "", str(madePenalties['bottomLeftCorner']) + "\nSaved: " + str(missedPenalties['bottomLeftCorner']), "", str(madePenalties['bottomRightCorner']) + "\nSaved: " + str(missedPenalties['bottomRightCorner']), "", ""]]

    f = plt.figure()
    plt.title(playerName)
    tb = plt.table(cellText=matrix, loc=(0, 0), cellLoc='center')

    tc = tb.properties()['child_artists']
    for cell in tc:
        cell.set_height(1.0 / hPositions)
        cell.set_width(1.0 / vPositions)

    ax = plt.gca()
    ax.set_xticks([])
    ax.set_yticks([])
    # plt.show()

    root = Tk.Tk()
    root.wm_title("Penalty Visualization")

    Label(root, text="Start Date").grid(row=0)
    Label(root, text="End Date").grid(row=1)
    startDate = Entry(root)
    endDate = Entry(root)

    startDate.grid(row=0, column=1)
    endDate.grid(row=1, column=1)
    canvas = FigureCanvasTkAgg(f, master=root)
    canvas.show()
    canvas.get_tk_widget().pack(side=Tk.LEFT)
    Tk.mainloop()
Esempio n. 29
0
 def on_post(self, req, resp):
     try:
         print("ON_POST")
         SQL.enter(req.path, req.stream)
         resp.status = falcon.HTTP_200
     except psycopg2:
         resp.status = falcon.HTTP_400
     except falcon:
         resp.status = falcon.HTTP_501
def insertion_visitors_buids(conn, coll, datapoint, attributes, fk, data_fk):
    if 'buids' in datapoint:
        data = datapoint['buids']
        for element in data:
            query = "INSERT INTO {} VALUES('{}',".format(coll, data_fk)
            attribute = str(element).replace("'", "")
            query += "'" + attribute + "'" + ","
            query = query[:-1] + ')'
            SQL.sqlexecute(conn, query, on_conflict=False)
Esempio n. 31
0
def main():
    #Download stream and start detection
    DetectExam

    #Insert result into database
    SQL.insert_detected_into_database()

    #Plot data
    SQL.detected_to_bar_chart()
Esempio n. 32
0
def mycourse():
    if user.gettype(current_user.id) == 'student':
        return render_template('return.html', message='学生不能开课')
    Tnum = user.getnum(current_user.id)
    ct = SQL.select('select * from ct where Tnum=\'%s\'' % Tnum)
    for i in ct:
        i['Cname'] = SQL.selectone(
            'select name from courses where num=\'%s\'' % i['Cnum'])['name']
    return render_template('mycourse.html', ct=ct)
Esempio n. 33
0
def compute(request_date,
            prd_grp_fin,
            policy_id,
            issue_date=None,
            end_date=None,
            start_date=None,
            premium=None,
            commission=None):
    try:
        if (premium == None) or (issue_date == None) or (end_date == None) or (
                start_date == None) or (commission == None):
            issue_date, end_date, start_date, premium, commission = SQL.retrieve(
                policy_id)
        else:
            issue_date = datetime.strptime(issue_date, '%Y-%m-%d')
            start_date = datetime.strptime(start_date, '%Y-%m-%d')
            end_date = datetime.strptime(end_date, '%Y-%m-%d')
            premium = float(premium)
            commission = float(commission)

        if request_date > end_date:
            msg = 'Sorry, your cancellation requested date is after the policy has expired! No Premium is refunded'
        elif request_date < issue_date:
            msg = 'You cannot request a refund prior to the policy is issued'
        else:
            earned = cal.function(issue_date, start_date, end_date,
                                  request_date, prd_grp_fin)
            Premium_refunded = round(premium * (1 - earned), 2)
            returned_commission = round(commission * (1 - earned), 2)

            if Premium_refunded == round(premium, 2):
                refund_type = 'FULL REFUND'
            elif Premium_refunded == 0:
                refund_type = 'NO REFUND'
            else:
                refund_type = 'PARTIAL REFUND'

            msg = {
                'POLICY_ID': policy_id,
                'ISSUE_DATE': issue_date,
                'START_DATE': start_date,
                'END_DATE': end_date,
                'REQUEST_DATE': request_date,
                'CAL_METHOD': prd_grp_fin,
                'ORIGINAL_PREMIUM': premium,
                'COMMISSION': commission,
                'REFUND_PERCENT': (1 - earned),
                'PREMIUM_REFUND': Premium_refunded,
                'RETURNED_COMMISSION': returned_commission,
                'REFUND_TYPE': refund_type,
                'PROCESS_DATE': datetime.now()
            }

    except:
        msg = SQL.retrieve(policy_id)
    return msg
    def add(self, vecs, label):
        for table_id in range(self.num_tables):
            projection_string, hash_size = SQL.get_table_data(db_conn, table_id)
            projections = numpy.frombuffer(projection_string).reshape((int(hash_size), int(config.FV_SIZE)))
            hashes = hash_func(vecs, projections)
            hashes_no_dups = list(dict.fromkeys(hashes))

            for h in hashes_no_dups:
                count = hashes.count(h)
                SQL.insert_file_hash(db_conn, label, h, count, table_id)
Esempio n. 35
0
def leave():
    tchs = SQL.select('select num from teachers')
    lst = SQL.select('select * from leave where Snum=\'%s\'' %
                     user.getnum(current_user.id))
    for item in lst:
        if item['status'] == '未批准':
            return render_template('return.html', message='当前有未批准请假!')
        if item['status'] == '未销假':
            return render_template('return.html', message='当前有未销假请假!')
    return render_template('leave.html', tchs=tchs)
def leader():
    #前置處理
    
    #設定應存放資料表
    global newSQLlistname
    newSQLlistname=datetime.datetime.now().strftime('%Y-%m-%d')
    
    #確定應存放資料表存在與否,決定做選取或是新增
    try:
        SQL.newlist(newSQLlistname)
        print "創新資料表:"+newSQLlistname
    except:
        SQL.clear(newSQLlistname)        
        print "重製資料表:"+newSQLlistname
        
    #更新開啟(重製)程式時間
    global startday
    startday = datetime.datetime.now().strftime('%d')
    global starttime
    starttime = datetime.datetime.now().strftime('%H:%M:%S')
    
    #清除主測表中過時(非今日)資訊
    '''
    print str(fetchdata[0][1].day)
    print str(datetime.datetime.now().day)
    '''
    fetchdata = SQL.catchdbfetch(1)
    if  SQL.catchidnum()!=0:
        if  fetchdata[0][1].day!=datetime.datetime.now().day:
            SQL.clear('detect')
            print '清除過時資訊'
def update_table(accession):
    """
    Runs code for a single accession number. Assumes that DICOM images are 
    already on the local hard drive, in a folder with the name as the accesion 
    number, in data_loc.
    """
    accessnum=str(accession)
    exam_loc=data_loc+'/'+accessnum
    try:
        SQL.run_code(accessnum,exam_loc)
    except Exception as e:
        os.chdir(program_loc)
        fil=open('Errors.txt','a')
        fil.write(accessnum+'\t'+str(e)+'\n')
        fil.close()
        print "Error. Please check Errors.txt for more details."
    return
def post(img):
    #結束處理
    #1.新增三張前方無人資料表    
    savepic(img,SQL.catchidnum()+1,0)
    savepic(img,SQL.catchidnum()+1,0)
    savepic(img,SQL.catchidnum()+1,0)    
    print "流程正常,目前時間為"+str(datetime.datetime.now())
    
    #2.轉至資料至今日資料表
    global newSQLlistname
    SQL.copytonewlist(newSQLlistname)
    
    #3.將紀錄時間寫至文件
    nowtime = datetime.datetime.now().strftime('%H:%M:%S')
    global starttime
    
    #兩時間差
    start = starttime
    end = nowtime
    start_dt = datetime.datetime(2011,1,1, int(start[:2]), int(start[3:5]), int(start[6:8]),0)
    end_dt = datetime.datetime(2011,1,1, int(end[:2]), int(end[3:5]), int(end[6:8]),0)

    diff_dt = end_dt - start_dt
    #print str(diff_dt)    
    diff_dt_s = diff_dt.seconds
    #------兩時間差end
    #diff_dt_s = int(str(diff_dt)[:2]*60*60+int(str(diff_dt)[3:5])*60+int(str(diff_dt)[6:8])    
    nowYMD=datetime.datetime.now().strftime('%Y-%m-%d')
    SQL.writedocument(nowYMD,int(diff_dt_s),starttime)
    print '拍攝時間'+str(diff_dt_s)+'秒' 
Esempio n. 39
0
 def on_get(self, req, resp):
     try:
         print("ON_GET")
         resp.body = SQL.query(req.path, req.stream)  # How will this be represented
         resp.status = falcon.HTTP_200
     except psycopg2:
         resp.status = falcon.HTTP_400
     except falcon:
         resp.status = falcon.HTTP_501
def leader(name):
                #清空暫時存資料表
                SQL.clear('tem')
                
                #將主資料表所有資料轉至暫存資料表
                SQL.copytonewlist('tem')
                
                #清空主資料表
                SQL.clear('detect')
                
                #將要分析之資料表轉至主資料表
                SQL.copyttodetect(str(name))
def issue_sqls():
    sqls = SQL.get_sqls()
    for sql_no, sql in enumerate(sqls):
        drop_page_cache_if_necessary()

        cmd = get_sql_cmdline(sql)
        (stdout_str, stderr_str) = Util.sh_cmd_sync(cmd)

        row_dict = ResultsDb.get_row_dict(sql, sql_no)
        ResultsDb.pretty_print_row(stdout_str, stderr_str, row_dict)
        ResultsDb.insert(row_dict)
def savepic(savepic,savepicid,pnum):#(儲存影像,影像編號,儲存路徑)
    #若圖片人數為0則代表進入循環末端處理
    if pnum != 0:
    #如為正常儲存程序(非進入循環末端處理)時,為保持固定秒數儲存的功能,進入判定是否應新儲存圖像
        
        #更新現在時間
        nowtime = datetime.datetime.now()
        datename = datetime.datetime.now().strftime('%Y-%m-%d')
        
        #確認間隔時間
        saveintervaltime =  9
        f=SQL.catchdbfetch(SQL.catchidnum())
        
        
        #讀取上次儲存時間
        global lastsavecount
        global piccount
        if SQL.catchidnum()==0:
            print '第一筆資料'
        #若上次儲存時間至今已超過"圖像儲存間隔時間",則進入接續進入儲存程序,不滿條件則跳出
        elif (piccount-lastsavecount)<saveintervaltime :
            if int(pnum) > int(f[0][3]):
                '''
                print piccount
                print lastsavecount
                print '現在日期'+str(pnum)
                print 'id: '+str(SQL.catchidnum())
                print '上次人數'+str(f[0][3])
                print '時間名子'+str(datename)
                '''
                print '-'
                SQL.updatef(datename,pnum,SQL.catchidnum())
            return
                
            
        #更新上次儲存時間
        lastsavecount = piccount

    #合併儲存路徑
    savedir = config.savedir+config.savename+' ('+str(savepicid)+').'+config.savetype

    #儲存圖像至本機端
    pichost.save(savepic,savedir)

    #儲存圖像至SQL
    SQL.insertpythondetect_frompic(savedir,savepicid,pnum)
    
    #開啟倒數機制(循環末端處理)
    global countdownhandle
    countdownhandle=1
def post():
        try:
                SQL.clear('detect')
                SQL.copyttodetect('tem')
                SQL.clear('tem')
                print 'reset success'
        except:
                print 'reset error'
def fill_table(numberofstudies,option='SQL'):
    """
    Runs through every exam listed in 'List of StudyIDs.txt'. Either prints
    information to text files that can be viewed in Excel, or writes directly
    to the database.
    Takes in option as a string and numberofstudies as an integer.
    """
    start=time.time()
    os.chdir(program_loc)
    StudyIDs.create_list(numberofstudies)
    data=open('List of StudyIDs.txt','r')

    for line in data:
        try:
            examID=str(line[line.find('[')+1:line.find(']')])
            exam_loc=data_loc+'/'+examID
            query.queries(examID)
            if option=='Instances':
                instances.run_code(examID,exam_loc)
            elif option=='SQL':
                SQL.run_code(examID,exam_loc)
                os.chdir(program_loc)
            else:
                pass
            shutil.rmtree(exam_loc)     #deletes files after use
            os.chdir(program_loc)
        #writes any errors to a file. continues through loop
        except Exception as e:
            os.chdir(program_loc)
            fil=open('Errors.txt','a')
            fil.write(line+'\t'+str(e)+'\n')
            fil.close()
    
    data.close()
    end=time.time()
    #prints how long it took to run in seconds
    print end-start
    return
Esempio n. 45
0
def distcheck(a):
    avg = SQL.getavg()
    cmpe = vectordist(a, avg[0])
    cheme = vectordist(a, avg[1])
    ee = vectordist(a, avg[2])
    meche = vectordist(a, avg[3])	
    minm = min(cmpe, cheme, ee, meche)
    if  minm == cmpe:
        return "Computer Engineering", "CmpE"
    elif minm == cheme:
        return "Chemical Engineering", "ChemE"
    elif minm == ee:
        return "Electrical Engineering", "EE"

    return "Mechanical Engineering", "MechE"
def countdown():
    #更新現在時間
    nowtime = datetime.datetime.now()
    
    #讀取倒數時間長度設定值
    countdownintervaltime = config.countdownintervaltime#(day,second,milliseconds)   
    
    #讀取上次儲存時間
    global lastsavetime
    
    #若上次儲存時間至今已超過"倒數時間長度設定值",則進入接續進入儲存程序,不滿條件則跳出
    if(nowtime-lastsavetime)>countdownintervaltime:
        #三次儲存(因應後計算門閘值)
        savepic(img,SQL.catchidnum()+1,0)
        savepic(img,SQL.catchidnum()+1,0)
        savepic(img,SQL.catchidnum()+1,0)
        
        #關閉倒數機制
        global countdownhandle
        countdownhandle=0
        
        
        #顯示完成循環末端處理
        print '!!Notic: !!! 三秒內無人觀看'
Esempio n. 47
0
def UpdateCodes():
    db = SQL.sql(__index_db)
    db.set("CREATE TABLE IF NOT EXISTS {}(code char(6) unique, name char(36))".format(__index_table))
    for index in range(__begin_index, __end_index):
        index_str='{:0>6}'.format(index)
        content = URL.request(__index_url.format(index_str))
        index_begin = content.find('var STOCKSYMBOL = \'')
        if index_begin == -1:
            continue
        index_end = content.find('\'', index_begin + 19)
        index_code = content[index_begin + 19:index_end]
        index_begin = content.find('var STOCKNAME = \'')
        if index_begin == -1:
            continue
        index_end = content.find('\'', index_begin + 17)
        index_name = content[index_begin + 17:index_end]
        LOG.info ('%s %s' %(index_code, index_name))
        __indexs.append([index_code, index_name])
        db.set("REPLACE INTO {} VALUES(\'{}\',\'{}\')".format(__index_table, index_code, index_name))
    db.close()
Esempio n. 48
0
def UpdateIndexs():
    db = SQL.sql(__index_db)
    for index in __indexs:
        index_code = index[0]
        index_name = index[1]
        LOG.info ("Updating index %s %s" % (index_code, index_name))
        command = "CREATE TABLE IF NOT EXISTS `{}`(date char(8) unique, price double, volume double)".format(index_code)
        db.set(command)
        historys = GetIndex(index_code, __begin_year, __end_year)
        for record in historys:
            date = record[0]
            try :
                price = float(record[4])
            except :
                price = 0
            try :
                volume = float(record[7])
            except :
                volume = 0
            #print ("%s %s %s" % (record[0], record[4], record[7]))
            command = "REPLACE INTO `{}` VALUES({},{},{})".format(index_code, date, str(price), str(volume))
            #print (command)
            db.set(command)
    db.close()
        
        t = clock() #?
        # --------------------by Wang Chunshan
        
        
        #循環時間間隔
        cv2.waitKey(WT)
        
        #複製影像
        vis = img.copy()
        
        #當有偵測到人時        
        if catchface.reboolean(img) == 1:
            peoplenum = catchface.repeoplenum(img)
            vis = catchface.draw(img)
            savepic(vis,SQL.catchidnum()+1,peoplenum)
                        
        # --------------------
       
        
        # --------------------by Wang Chunshan
        # 倒數機制
        '''
        if countdownhandle==1:
            countdown()
        '''
        # --------------------

        if 0xFF & cv2.waitKey(5) == 27:
            break
        
        
        
        t = clock() #?
        # --------------------by Wang Chunshan
        
        
        #循環時間間隔
        cv2.waitKey(WT)
        
        #複製影像
        vis = img.copy()
        
        #當有偵測到人時        
        if catchface.reboolean(img) == 1:
            peoplenum = catchface.repeoplenum(img)
            savepic(img,SQL.catchidnum()+1,peoplenum)
            vis = catchface.draw(img)            
        # --------------------
        cv2.imshow(facedetect, vis)

        
        # --------------------by Wang Chunshan
        # 倒數機制
        if countdownhandle==1:
            countdown()
        
        # --------------------

        if 0xFF & cv2.waitKey(5) == 27:
            break
    post(img)
Esempio n. 51
0
def createfile(name,content):
	'''This function is not used at all'''
	global files,file_content,file_mode
	name='/'+name
	files.append(name)
	file_content[name]=content
	st=MyStat()
	st.st_mode=stat.S_IFREG|0777
	st.st_nlink=1
	st.st_size=len(file_content[name])
	file_mode[name]=st

def main(tbs):
	
	server=FuseFS(version="%prog "+fuse.__version__,usage="Error",tbs=tbs)
	utils.Logger('********tbs',str(tbs[0]))
	utils.Logger('********objs',str(tbs[1]))
	server.parse(errex=1)
	server.main()		#Start the main event loop

def initialize():
	server=FuseFS(version="%prog "+fuse.__version__,usage="Error")
	server.parse(errex=1)
	return server

if __name__=='__main__':
	utils.TruncateFiles()		'''Truncate the log files'''
	tbs,dbobjlist = SQLdir(SQL.listdatabases('localhost','guest','',''))
	utils.Logger('dbobjlist',str(dbobjlist))
	main((tbs,dbobjlist))
Esempio n. 52
0
reinterpreteren, så som i form af dicts der representere databaser eller noget lign.

Herefter tester vi om den DW som ens pygrametl program gerne burde have populeret
overholder nogle egenskaber.
"""
# Import af vores ting
from reinterpreter import Reinterpreter
from predicate import DuplicatePredicate


# Import af et eller andet SQL libary
import SQL

# Vi laver nogle connections til forskellige databaser
# Først et DW som skal blive brugt af connection wrapperen i ens pygrametl program
conn_dw = SQL.connect('a.db')

# Derefter connecter vi til de databaser som skal bruges som skal bruges i extract
# delen af ens pygrametl program
conn_input_1 = SQL.connect('b.db')
conn_input_2 = SQL.connect('c.db')

# Vi definere et pygrametl program, dette kunne også gives som en path til en fil.
program =\
"""
import pygrametl
from pygrametl.datasources import *
from pygrametl.tables import *
import sqlite3

conn_out = sqlite3.connect('out.db')
def main(index,s,e,sel):
    tables = SQL.tables()
    #by Wangchunshan
    print "選擇資料表為:"+str(tables[index][0])
    leader(str(tables[index][0]))
    #set var
    ALLcount = 0
    addtime =""
    lesstime = ""
    s1=0
    s2=0
    s3=0
    s4=0
    addtimearray = []
    lesstimearray = []
    addtimearraypicname = []
    lesstimearraypicname = []
    firsttime = ""
    endtime =""
    detecttime=0#觀測時間
    SSTime = []
    SETime = []
    selecttimerange = sel   
    #選擇的時間範圍-開始
    '''
    SSTime[0]=selecttimerange[:2]
    SSTime[1]=selecttimerange[3:5]
    SSTime[2]=selecttimerange[6:8]
    SSTime[3]=selecttimerange[9:11]
    #選擇的時間範圍-結束
    SETime[0]=selecttimerange[12:14]
    SETime[1]=selecttimerange[15:17]
    SETime[2]=selecttimerange[18:20]
    SETime[3]=selecttimerange[21:23]
    '''
    
    fetchdata = SQL.catchdbfetch(1)
    #將文字轉為日期形式
    SSTime.append(int(selecttimerange[:2]))
    SSTime.append(int(selecttimerange[3:5]))
    SSTime.append(int(selecttimerange[6:8]))
    SSTime.append(int(selecttimerange[9:11]))
    SSTime_=datetime.datetime(fetchdata[0][1].year,fetchdata[0][1].month,fetchdata[0][1].day,SSTime[0],SSTime[1],SSTime[2],SSTime[3])
    
    SETime.append(int(selecttimerange[12:14]))
    SETime.append(int(selecttimerange[15:17]))
    SETime.append(int(selecttimerange[18:20]))
    SETime.append(int(selecttimerange[21:23]))
    SETime_=datetime.datetime(fetchdata[0][1].year,fetchdata[0][1].month,fetchdata[0][1].day,SETime[0],SETime[1],SETime[2],SETime[3])
    
    #print SSTime
    #print SETime
    #資料庫
    #
    # 
    for x in SQL.searchdocument(str(tables[index][0])):
        detecttime+=int(x[2])
    
    for x in range(SQL.catchidnum()):
        #By Wangchunshan
        #讀取單筆資料 [0][2] =>路徑 [0][1]=>時間 
        fetchdata = SQL.catchdbfetch(x+1)
        if fetchdata[0][1]> SSTime_ and fetchdata[0][1]<SETime_:    

            if 0xFF & cv2.waitKey(5) == 27:
                break
            #By Wangchunshan

        #!  #讀取此圖像中可判別的臉數
            count = fetchdata[0][3]
            print count

           
            #提示讀取圖像id與判別後數值
            #print '圖像id:'+str(fetchdata[0][0])+' ,圖片路徑:'+fetchdata[0][2]+' ,有'+str(count)+'張臉'
            
            #終端處理
        #!  #更新最新時間點圖像之臉數        
            count_after = count

            #確定人數增加時間點
            if count_after>s1  :
                
               #總觀看人數增加
               if (count_after-s1)==(count_after-s2) and (count_after-s1)==(count_after-s3):
                   ALLcount+=(count_after-s1)               
                   errorpop = ""  
               else:
                   errorpop = "\n***發現誤差值可能***\n照片編號:"+str(fetchdata[0][0])+"\n"    
               
               for p in range(count_after-s1):
                   addtimearray.append(fetchdata[0][1])           
                   addtimearraypicname.append(fetchdata[0][0])
               #紀錄增加時間點與增加人數
               addtime += errorpop+str(fetchdata[0][1])+",增加人數為:"+str(count_after-s1)+"\n"
               #紀錄開始時間
               if firsttime =="":
                    firsttime = fetchdata[0][1]
            
            #確定人數減少時間點
            if count_after<s1:            
               for p in range((count_after-s1)*-1):
                   lesstimearray.append(fetchdata[0][1])              
                   lesstimearraypicname.append(fetchdata[0][0])
               lesstime += str(fetchdata[0][1])+",減少人數為:"+str((count_after-s1)*-1)+"\n"
               endtime = fetchdata[0][1]
            s4 = s3
            s3 = s2
            s2 = s1
            s1 = count_after 
            #資料解析

    #輸出 "增加人數時間點" 與 "人數減少時間點"之情況   
    #print '\n\n\n增加人數時間點\n'+addtime+'\n\n\n人數減少時間點\n'+lesstime
    errortime = 0
    allwatch = 0
    #print len(addtimearray)
    #print len(lesstimearray)
    print '\n\n'
    print '計算完成,開始輸出結果'
    print '\n\n'
    for x in range(len(addtimearray)):        
        if len(addtimearray)>=x+1 and len(lesstimearray)>=x+1:
            print '第'+str(x+1)+'位觀看者\n從'+str(addtimearray[x])+'開始觀看,至'+str(lesstimearray[x])+'結束觀看'
            print '注視時間長度為:'+str((lesstimearray[x]-addtimearray[x]).seconds)+"秒"
            print '判別增加.照片編號為:'+str(addtimearraypicname[x])+',判別減少.照片編號為:'+str(lesstimearraypicname[x])
            print '\n\n'
            allwatch += int((lesstimearray[x]-addtimearray[x]).seconds)
                      
        else:
            errortime+=1
    if ALLcount==0:
        print "時間區隔中總觀看人次為零"
    else:
        
        #邏輯錯誤計算 預測情況:離開事件發生數大於進入事件發生數
        #print '錯誤次數'+str(errortime)+"\n"
        
        print "今日總偵測時間:"+str(detecttime)+"秒" 
        print "選擇時間區隔為:"+str(selecttimerange)+"\n時間區隔共有"+str((SETime_-SSTime_).seconds)+"秒" 
        print "時間區隔中總觀看人次:"+str(ALLcount)       
        print "時間區隔中總被觀看時間(每人次注視時間相加總):"+str(allwatch)+"秒"
        print "時間區隔中平均每人次觀看時間:"+str(allwatch/ALLcount)+"秒"        
        
        
        
        
    #s=raw_input('Want More Detailed?Y or N :')
    s="Y"
    if(s=="Y"):
        #main(index,s,e)
        s="x"
        
    
    
    print
    print
    print "          ---------------------------------------------------"
    print
    print
    print
Esempio n. 54
0
 def pulluser(self):
     user = raw_input('What was your User ID? ')
     if SQL.pullexisting(user) == 1:
         self.neworold()
Esempio n. 55
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle("Gentle Effects Customer Management System")

        self.status_bar = QStatusBar()
        self.status_label = QLabel()
        self.status_bar.addWidget(self.status_label)

        self.path = "GentleEffects.db"
        self.connection = SQL(self.path)
        self.connection.open_database()
        
        self.status_label.setText("Connected to {0}".format(self.connection.db.databaseName()))
        self.setStatusBar(self.status_bar)

        self.title_label = QLabel("""<html>
                                          <body>
                                                   <p><span style=" font-size:16pt; font-weight:1000; color:green">Welcome to Gentle Effect's Customer Management System</span></p>
                                          </body>
                                         </html>""")

        #Actions for use within menus / toolbars
        #Customer Details Management
        self.new_customer = QAction("Add New Customer",self)
        self.edit_customer = QAction("Edit Exisiting Customer",self)
        self.edit_medical = QAction("Edit Medical Information",self)
        self.add_allergy = QAction("Add Allergy to DB",self)
        self.edit_allergy = QAction("Edit Allergy",self)
        self.delete = QAction("7 Year bulk delete",self)
        #Treatment Managemnet
        self.add_treatmnet = QAction("Add New Treatment",self)
        self.edit_treatment = QAction("Edit Exisiting Treatment",self)
        #Appointment Management
        self.new_appointment = QAction("Create Appointment",self)
        self.edit_appointment = QAction("Amend Appointment",self)
        self.cancel_appointmnet = QAction("Cancel Appointment",self)
        #Supplier Managment
        self.new_supplier = QAction("Add New Supplier",self)
        self.amend_supplier = QAction("Amend Supplier",self)
        self.delete_supplier = QAction("Remove Supplier",self)
        #Product Management
        self.new_product = QAction("Add New Product",self)
        self.ammend_product = QAction("Amend Product Details",self)
        self.delete_product = QAction("Delete Existing Product",self)
        #Order Management
        self.new_order = QAction("Add New Order",self)
        self.amend_order = QAction("Amend Order",self)
        self.cancel_order = QAction("Cancel Order",self)
        #Administration
        self.create_reports = QAction("Create Reports",self)
        self.backup = QAction("Backup Database",self)
        self.database = QAction("Set Database File Path",self)
        self.add_user = QAction("Add System User",self)
        self.edit_user = QAction("Edit User",self)
        #Extra
        self.reset_central_widget = QAction("Reset Screen",self)

        #Create Menubar
        self.menu_bar = QMenuBar()
        self.customer_menu = self.menu_bar.addMenu("Customers")
        self.treatment_menu = self.menu_bar.addMenu("Treatments")
        self.appointment_menu = self.menu_bar.addMenu("Appointments")
        self.supplier_menu = self.menu_bar.addMenu("Suppliers")
        self.product_menu = self.menu_bar.addMenu("Products")
        self.order_menu = self.menu_bar.addMenu("Orders")
        self.admin_menu = self.menu_bar.addMenu("Administration")
        self.menu_bar.addAction(self.reset_central_widget)
        #Add Actions to the Menu Bar
        self.customer_menu.addAction(self.new_customer)
        self.customer_menu.addSeparator()
        #self.customer_menu.addAction(self.edit_customer)
        #self.customer_menu.addAction(self.edit_medical)
        self.customer_menu.addSeparator()
        #self.customer_menu.addAction(self.add_allergy)
        #self.customer_menu.addAction(self.edit_allergy)
        self.customer_menu.addSeparator()
        #self.customer_menu.addAction(self.delete)
        self.treatment_menu.addAction(self.add_treatmnet)
        self.treatment_menu.addAction(self.edit_treatment)
        self.appointment_menu.addAction(self.new_appointment)
        self.appointment_menu.addAction(self.edit_appointment)
        #self.appointment_menu.addAction(self.cancel_appointmnet)
        self.supplier_menu.addAction(self.new_supplier)
        self.supplier_menu.addAction(self.amend_supplier)
        #self.supplier_menu.addAction(self.delete_supplier)
        self.product_menu.addAction(self.new_product)
        self.product_menu.addAction(self.ammend_product)
        #self.product_menu.addAction(self.delete_product)
        self.order_menu.addAction(self.new_order)
        #self.order_menu.addAction(self.amend_order)
        #self.order_menu.addAction(self.cancel_order)
        #self.admin_menu.addAction(self.create_reports)
        self.admin_menu.addSeparator()
        #self.admin_menu.addAction(self.backup)
        #self.admin_menu.addAction(self.database)
        self.admin_menu.addSeparator()
        #self.admin_menu.addAction(self.add_user)
        #self.admin_menu.addAction(self.edit_user)

        self.setMenuBar(self.menu_bar)

        self.reset_screen()

        #connections
        self.new_customer.triggered.connect(self.view_add_new_customer)
        self.add_treatmnet.triggered.connect(self.add_new_treatment)
        self.new_appointment.triggered.connect(self.create_appointment)
        self.reset_central_widget.triggered.connect(self.reset_screen)
        self.new_product.triggered.connect(self.view_add_new_product)
        self.new_supplier.triggered.connect(self.view_add_new_supplier)
        self.new_order.triggered.connect(self.create_order)
        self.add_user.triggered.connect(self.test_area)
        self.ammend_product.triggered.connect(self.ammend_product_details)
        self.amend_supplier.triggered.connect(self.amend_supplier_details)
        self.edit_appointment.triggered.connect(self.edit_appointment_details)
Esempio n. 56
0
#!/usr/local/bin/python2.5
from libreria import *
from SQL import *

lib = libreria()
sql = SQL()

#nos conectamos a los sitios NTT y Cacti
lib.connectCacti()
lib.connectNTT()

#obteneoms el reporte General de NTT America del periodo anterior
lib.generarReporteGeneral()

#obtenemos la lista de servidores que necesitamos de NTT America
listaServidores = lib.getListaServidores()

#Obtenemos la lista de cacti para buscar el ID de la grafica del servidor que necesitamos de NTT
listaCacti = sql.getListaCacti()
##print listaCacti

#lista servidores validos
validos = []

#buscamos el servidor de NTT en cacti para obtener el ID de la grafica de traffic
for i in listaServidores:
	for j in listaCacti:
		#Verificamos que sea el mismo servidor
		if j[0].find(i)==0:
			#servidor es una lista donde j[0] = Nombre servidor, j[1] = ID grafica de trafico
			#En esta parte generamos todo, trafico, servidores y crear tabla