Exemplo n.º 1
0
 def keyReg(self,widget,event):
     if gtk.gdk.keyval_name(event.keyval)=='Delete' and int(Glob.acc[1])==1:
         sel=widget.get_selection()
         mod,it=sel.get_selected()
         if it:
             msgbx=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                     gtk.BUTTONS_YES_NO,'You are about to delete a Series, Are you sure?')
             #msgbx.set_decorated(False)
             msgbx.set_position(gtk.WIN_POS_CENTER)
             res=msgbx.run()
             msgbx.destroy()
             if res==gtk.RESPONSE_YES: 
                 try:
                     Conn.conDB().ser(3, mod[it][1])              
                     mod.remove(it)
                     Glob.ser=[]
                     for i in range(len(self.regs)):
                         Glob.ser.append([self.regs[i][0],self.regs[i][1]])
                 except:
                     msgbx=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'An error Occured, the Series was not Deleted?')
                     #msgbx.set_decorated(False)
                     msgbx.set_position(gtk.WIN_POS_CENTER)
                     msgbx.run()
                     msgbx.destroy()
Exemplo n.º 2
0
 def insertImagem(self, img):
     con = Conn() # Cria objeto Conn
     db = con.getConn() #Cria conexao
     data = time.strftime("%Y-%m-%d")
     cursor = db.cursor() #Cria cursor para operacoes com db
     cursor.execute("INSERT INTO imagem VALUES(%s, %s, %s, %s)", (img.codImage,img.caminho, img.seEmpresa, str(data)))
     db.commit()
     db.close()
Exemplo n.º 3
0
 def insertUrl(self, url):
     con = Conn() # Cria objeto Conn
     db = con.getConn() #Cria conexao
     data = time.strftime("%Y-%m-%d") #pega current date yyyy-MM-dd
     cursor = db.cursor() #Cria cursor para operacoes com db
     cursor.execute("INSERT INTO url VALUES(%s, %s, %s, %s)", (url.codUrl, url.caminho, url.seEmpresa, str(data)))
     db.commit()
     db.close()
Exemplo n.º 4
0
 def insertProdutoSetor(self, produtoSetor):
     con = Conn() # Cria objeto Conn
     db = con.getConn() #Cria conexao
     data = time.strftime("%Y-%m-%d") #pega current date yyyy-MM-dd
     cursor = db.cursor() #Cria cursor para operacoes com db
     cursor.execute("INSERT INTO produto_setor VALUES(%s, %s, %s, %s)",(produtoSetor.codProdutoSetor, produtoSetor.codProduto,
                    produtoSetor.codSetor, str(data)))
     db.commit()
     db.close()
Exemplo n.º 5
0
 def insertProduto(self, produto):
     con = Conn() # Cria objeto Conn
     db = con.getConn() #Cria conexao
     data = time.strftime("%Y-%m-%d") #pega current date yyyy-MM-dd
     cursor = db.cursor() #Cria cursor para operacoes com db
     cursor.execute("INSERT INTO produto VALUES(%s, %s, %s, %s, %s,%s, %s, %s, %s, %s)",
                    (produto.codProduto, produto.codEmpresa, produto.codImagem, produto.codUrl, data, str(produto.nome).decode('UTF-8',errors='strict'),
                     produto.pesquisa, produto.precoOriginal, produto.precoPromocao, produto.seAtivo))
     db.commit()
     db.close()
Exemplo n.º 6
0
 def pref(self,widget,event,page):
     if page==3:
         res,acc=log.log().login('Create')
         if res==gtk.RESPONSE_OK:
             try:
                 Conn.conDB().acc(1,acc)
             except:
                 msgbx=gtk.MessageDialog(self.back,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                     gtk.BUTTONS_OK,'The Account Could not be Created as it ALREADY EXISTS')
                 #msgbx.set_decorated(False)
                 msgbx.run()
                 msgbx.destroy()
     else:
         tools.Tools().back(page)
Exemplo n.º 7
0
 def __init__(self,db,fid,enterPoint,webTagField,tableField):
     print("Start to download from nature")
     self.conn_ = Conn.conn(db)
     self.fid_ = fid
     self.indexUrl_ = enterPoint
     self.webFeild_ = webTagField
     self.tableFeild_ = tableField
Exemplo n.º 8
0
 def setup_class(self):
     switchip = str(cfg.get('SANSwitches', 'switch0'))
     ssh_port = cfg.getint('SANSwitcheSetting', 'ssh_port')
     user = str(cfg.get('SANSwitcheSetting', 'username'))
     password = str(cfg.get('SANSwitcheSetting', 'password'))
     timeout = 2
     self.ssh = Conn.SSHConn(switchip, ssh_port, user, password, timeout)
Exemplo n.º 9
0
 def __init__(self,name,date,time,doctorName,patientName="张宇微"):
     self.keshiName = name
     self.appDate = date
     self.doctorName = doctorName
     self.patientId = self.userDict[patientName]
     self.doctorId = self.doctorDict[doctorName]
     print("="*50)
     print("即将为"+patientName+"预约 "+self.appDate+" "+time+"["+name+"]的["+doctorName+"]")
     self.conn_=Conn.conn("BJGuahao")
     #2_2_2016-11-10 行_上1/下2午_日期
     if time == "上午" :
         self.appTime = "1"
     if time == "下午" :
         self.appTime = "2"
         
     self.client = BjguahaoClient.BjguahaoClient()
     #以下,找到对应科室的预约网址
     soup = BS(self.client.open(self.appointMainurl).text, "html.parser")
     self.keshiurl = self.homeurl
     for x in soup.find_all("a", class_="kfyuks_islogin",text=re.compile(self.keshiName)):
         if x.get_text() == self.keshiName:
             self.keshiurl += x["href"]               
             res = self.client.open(self.keshiurl).text
             soup = BS(res, "html.parser")
             self.departmentId = soup.find(id="dId")["value"]
             print("正在打开["+x.get_text()+"]\t科室代码["+self.departmentId+"]")
             print("=" * 50)                
             break
Exemplo n.º 10
0
    def init_conn(self):
        if self._conn is not None:
            return
        elif self._proc is None:
            raise Exception('Process terminated')

        # check proc
        if self._proc.poll() != None:
            ##import pdb; pdb.set_trace()
            raise Exception('Process terminated with exit code: %d' %
                            self._proc.poll())

        try_count = 0
        conn = None
        e = None
        while try_count < 30:  # 3 sec.
            try:
                conn = Conn.Conn(self.pgs.host,
                                 self.pgs.base_port + self._port_off)
                conn.do_request('ping')
                break
            except:
                e = sys.exc_info()[0]
                time.sleep(0.1)
                try_count = try_count + 1

        if conn == None:
            self._conn = None
            raise Exception('Failed to connect:%s' % str(e))
        else:
            self._conn = conn
Exemplo n.º 11
0
 def __init__(self, db, fid, enterPoint, webTagField, tableField):
     print("Start to download from nature")
     self.conn_ = Conn.conn(db)
     self.fid_ = fid
     self.indexUrl_ = enterPoint
     self.webFeild_ = webTagField
     self.tableFeild_ = tableField
Exemplo n.º 12
0
 def search(self,widget,event):
     lst='select*from record'
     par=''
     if self.txtReg.get_active()!=-1:
         par=par + " reg="+str(self.txtReg.get_active())+ " and"
     if self.txtCode.get_active()!=-1:
         par=par + " code like '%"+self.txtCode.get_text()+ "%' and"
     if self.txtRef.get_text()!='':
         par=par + " ref like '%"+self.txtRef.get_text()+ "%' and"
     if self.txtCon.get_text()!='':
         par=par + " consign like '%"+self.txtCon.get_text()+ "%' and"
     if self.txtL.get_text()!='':
         par=par + " loc like '%"+self.txtL.get_text()+ "%' and"
     if self.txtBox.get_text()!='':
         par=par + " box='"+self.txtBox.get_text()+ "' and"
     if self.txtSub.get_text()!='':
         par=par + " sub like '%"+self.txtSub.get_text()+ "%' and"
     if self.txtRet.get_text()!='':
         par=par + " ret >"+self.txtRet.get_text()+ " and"
     if self.txtAct.get_active() !=-1:
         par=par + " act='"+str(Glob.act[self.txtAct.get_active()][0])+ "' and"
     
             
     if len(par)>3:
         par=par[:len(par)-3]
         lst=lst+' where '+par
     
     b=(Conn.conDB().ref_list(0,lst))
     self.dialog.hide()
     records.Files().list(b)
     
Exemplo n.º 13
0
    def _telnet_connect(self):

        self._TN_Conn = conn.HAAPConn(self._host,
                                      self._TNport,
                                      self._password,
                                      self._timeout)

        self._TN_Connect_Status = self._TN_Conn.get_connection_status()
Exemplo n.º 14
0
    def test_logdelete(self):
        cm = None
        pgs1 = None
        try:
            cm = Cm.CM("test_portscan")
            cm.create_workspace()
            pg = Pg.PG(0)

            # pgs --> master
            pgs = Pgs.PGS(0, 'localhost', 1900, cm.dir)
            pg.join(pgs, start=True)
            pgs.smr.wait_role(Smr.SMR.MASTER)

            # -----------------------------------------
            # Test bad handshake blocks IP temporarily
            # -----------------------------------------
            for off in range(0, 3):
                # bad handshake
                try:
                    conn = Conn.Conn('localhost', 1900 + off)
                    resp = conn.do_request('ping')
                except:
                    pass
                self._check_conn_blocked()

            # wait for block released
            time.sleep(2.0)  # actually 1.5 sec

            # -------------------------------------------------------
            # Can't connect mgmt port SMR_MAX_MGMT_CLIENTS_PER_IP(50)
            # -------------------------------------------------------
            conns = []
            for i in range(50 - 1):  # -1
                conn = Conn.Conn('localhost', 1903)
                resp = conn.do_request('ping')
                assert (len(resp) == 1 and resp[0].startswith('+OK')), resp
                conns.append(conn)
            self._check_conn_blocked()

        finally:
            if pgs is not None:
                pgs.kill_smr()
                pgs.kill_be()
            if cm is not None:
                cm.remove_workspace()
Exemplo n.º 15
0
 def setup_class(self):
     engineip = str(cfg.get('Engines', 'engine0'))
     ftp_port = cfg.getint('EngineSetting', 'ftp_port')
     user = '******'
     password = ''
     timeout = 1.5
     print(engineip, ftp_port)
     self.ftp = Conn.FTPConn(engineip, ftp_port, user, password, timeout)
     conn = self.ftp._FTPconnect()
Exemplo n.º 16
0
 def __init__(self, filename='login.txt'):
     self.conn = None
     try:
         with open(filename, 'r') as fp:
             url, username, pwd, database = fp.readlines()[0].strip().split(
                 ',')
         self.conn = Conn.SQLServer(url, username, pwd, database)
     except:
         raise ("Error")
Exemplo n.º 17
0
 def key(self,widget,event):
     if gtk.gdk.keyval_name(event.keyval)=='Delete' and int(Glob.acc[1])==0:
         sel=widget.get_selection()
         mod,it=sel.get_selected()
         if it:
             msgbx=gtk.MessageDialog(self.dialog,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                     gtk.BUTTONS_YES_NO,'You are about to delete a FILE, Are you sure?')
             #msgbx.set_decorated(False)
             res=msgbx.run()
             msgbx.destroy()
             if res==gtk.RESPONSE_YES: 
                 try:
                     Conn.conDB().ref_list(1, mod[it][10])              
                     mod.remove(it)
                 except:
                     msgbx=gtk.MessageDialog(self.dialog,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'An error Occured, the Record was not Deleted?')
                     #msgbx.set_decorated(False)
                     msgbx.run()
                     msgbx.destroy()
Exemplo n.º 18
0
 def NewIndex(self):
     if not self.conns:
         return -1
     for i in xrange(len(self.conns)):
         if self.conns[i] is None:
             self.conns[i] = Conn.Conn()
             return i
         else:
             if self.conns[i].isUse is False:
                 return i
     return -1
Exemplo n.º 19
0
 def _get_switch_info(self):
     self._SWConn = conn.SSHConn(self._host, self._port, self._username,
                                 self._password, self._timeout)
     if self._SWConn.SSHConnection:
         self.strPorterrshow = self._SWConn.exctCMD('porterrshow')
         time.sleep(0.25)
         self.strSwitchshow = self._SWConn.exctCMD('switchshow')
         return True
     else:
         self.strPorterrshow = None
         self.strSwitchshow = None
Exemplo n.º 20
0
 def addReg(self,widget,ev,view):
     if self.txtReg.get_text()!='':
         try:
             for i in range(len(self.regs)):
                 if str(self.regs[i][0]).upper()==str(self.txtReg.get_text()).upper():
                     raise Exception('Exists')
             Conn.conDB().ser(2,self.txtReg.get_text())
             Glob.ser=Conn.conDB().ser(0,0)
             self.regs.clear()
             self.txtReg.set_text('')
             for i in range(len(Glob.ser)):
                 self.regs.append([str(Glob.ser[i][0]),Glob.ser[i][1]])
             view.set_model(self.regs)
         except:
             msgbx=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                             gtk.BUTTONS_OK,'The Series could not be add becasue it cannot acquire a Unique ID')
             msgbx.set_decorated(False)
             msgbx.set_position(gtk.WIN_POS_CENTER)
             res=msgbx.run()
             msgbx.destroy()
Exemplo n.º 21
0
def main():
    print("Marvellous Infosystems : Python Automation and Machine Learing ")
    print("\n\t\t Application name:", sys.argv[0])

    if (len(sys.argv) <= 2):

        if (len(sys.argv) == 1):
            print("Error :invalid number of arguments")
            exit()
        if (sys.argv[1] == '-h') or (sys.argv[1] == '-H'):
            print(
                "This script Accept Directory name from user and delete all duplicate files from the specified directory by considering the checksum of files.\
Create one Directory named as Marvellous and inside that directory create log file which maintains all names of duplicate files which are deleted.\
Name of that log file should contains the date and time at which that file gets created.\
Accept duration in minutes from user and perform task of duplicate file removal after the specific time interval.\
Accept Mail id from user and send the attachment of the log file.")
            exit()
        if (sys.argv[1] == '-u') or (sys.argv[1] == '-U'):
            print(
                "Usage : DuplicateFileRemoval.py  E:/Data/Demo 50  [email protected]\n\
- DuplicateFileRemoval.py\n\
Name of python automation script\n\
- E:/Data/Demo\n\
Absolute path of directory which may contains duplicate files\n\
- 50\n\
Time interval of script in minutes\n\
- [email protected]\n\
Mail ID of the receiver")
            exit()
        else:
            print("Error :invalid number of arguments")
            exit()
    try:
        if mailcheck.check(sys.argv[3]):
            connected = Conn.is_connected()
            if connected:
                schedule.every(int(sys.argv[2])).minute.do(DirectoryDusplicate,
                                                           path=sys.argv[1],
                                                           mailId=sys.argv[3])
                while True:
                    schedule.run_pending()
                    time.sleep(1)
            else:
                print("Interent connection is not Found")
        else:
            print("Invalied email please enter the valied email")
    except ValueError:
        print("Error : Invalied datatype of input ")
    except Exception:
        print("Error : Invalid input ")
    finally:
        print("Thank You  !!!!!")
Exemplo n.º 22
0
 def addRef(self,widget,ev,view):
     if self.txtRef.get_text()!='' and self.txtSub.get_text()!='':
         try:
             for i in range(len(self.refs)):
                 if str(self.refs[i][0]).upper()==str(self.txtRef.get_text()).upper():
                     raise Exception('Exists')
             data=[]
             data.append(self.txtRef.get_text())
             data.append(self.txtSub.get_text())
             Conn.conDB().ref(2,data)
             Glob.ref.append(([self.txtRef.get_text(),self.txtSub.get_text()]))
             self.refs.append([self.txtRef.get_text(),self.txtSub.get_text()])
             self.txtRef.set_text('')
             self.txtSub.set_text('')
             
         except:
             msgbx=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                             gtk.BUTTONS_OK,'The Reference could not be add becasue it cannot acquire a Unique ID')
             msgbx.set_decorated(False)
             msgbx.set_position(gtk.WIN_POS_CENTER)
             res=msgbx.run()
             msgbx.destroy()
Exemplo n.º 23
0
 def _telnet_connect(self):
     s.msg_out(self.message_output,
               '0. Telnet Connecting to %s ...\n' % self._host)
     self._TN_Conn = conn.HAAPConn(self._host, self._TNport, self._password,
                                   self._timeout)
     self._TN_Connect_Status = self._TN_Conn.get_connection_status()
     if self._TN_Connect_Status:
         s.msg_out(self.message_output,
                   '0. Telnet Connected to %s.\n' % self._host)
         s.chg_light_to_green(self.obj_light_telnet,
                              self.instance_light_telnet)
     else:
         s.msg_out(self.message_output,
                   '0. Telnet Connect to %s Failed!!!\n' % self._host)
Exemplo n.º 24
0
 def _check_conn_blocked(self):
     st = time.time()
     for i in range(40):
         ok = True
         try:
             conn = Conn.Conn('localhost', 1900 + (i % 4))
             resp = conn.do_request('ping')
         except:
             ok = False
         if ok:
             raise Exception("Not blocked")
     et = time.time()
     if et - st > 1.0:
         raise Exception("10 connection try exceeds 1.0 sec.")
Exemplo n.º 25
0
 def upAction(self,widget,event):
     try:
         datetime.datetime.strptime(self.ActDate.get_text(),'%d/%m/%Y')
         if self.cboAct.get_active<0:
             msgbx=gtk.MessageDialog(self.dialog,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'You have Not Selected Nay Action to Take!!')
             msgbx.set_decorated(False)
             res=msgbx.run()
             msgbx.destroy()
         else:
             store=[]
             itr=[]
             model = self.cboAct.get_model()
             active = self.cboAct.get_active()
             for it in range(len(self.lst)):
                 if self.lst[it][11]:
                     if  str(model[active][0])!=str(self.lst[it][9]):
                         stor=[]
                         '''#convert the combo active value to its item value'''
                         stor.append(model[active][0])
                         stor.append(self.ActDate.get_text())
                         stor.append(self.lst[it][10])
                         store.append(stor)
                     else:
                         self.lst[it][11]=False
                         
             if store!=[]:
                 Conn.conDB().recordUp(store)
             for row in self.lst:
                 if row[11]:
                     self.lst.remove(row.iter)
     except:
         msgbx=gtk.MessageDialog(self.dialog,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'The Action Date is not Correct')
         msgbx.set_decorated(True)
         res=msgbx.run()
         msgbx.destroy()        
Exemplo n.º 26
0
def teardown_cluster(name, force=False):
    debug = True
    conn = Conn.Conn(gCtx.opt.cm_host, gCtx.opt.cm_port)
    try:
        for pgs in gCtx.pgs_ary:
            conn.do_request('pgs_leave %s %d forced' % (gCtx.opt.cluster_name, pgs.id), debug)
            time.sleep(0.1)
            conn.do_request('pgs_del %s %d' % (gCtx.opt.cluster_name, pgs.id), debug)
        conn.do_request('pg_del %s 0' % gCtx.opt.cluster_name, debug)
        conn.do_request('cluster_del %s' % gCtx.opt.cluster_name, debug)
    except:
        print (sys.exc_info()[0])
        raise
    finally:
        conn.disconnect()
Exemplo n.º 27
0
 def Addrange(self,widget,event,stor):
     res,ran=rang.New().Ref()
     if res==gtk.RESPONSE_OK:# and ran!=[]:           
         try:
             for i in range(len(ran)):
                 if ran[i]=="":
                     msgbx=gtk.MessageDialog(self.dialog,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'Files could not be retrieved as you did not fill in all the parameters')
                     msgbx.set_decorated(False)
                     res=msgbx.run()
                     msgbx.destroy()
                     raise Exception('empty')
             
             sql="select*from dpp_registry where dpp_case_year="+str(ran[2])+\
             " and dpp_case_categ_id =" + str(ran[3])+" and dpp_case_seq_no between "+\
             str(ran[0]) +" and " + str(ran[1])
             dat=Conn.conDB().rang(sql)
             lst='select*from record'
             archd=(Conn.conDB().ref_list(0,lst))
             if dat!=[]:
                 if len(stor)==1 and stor[0][0]=='':
                     stor.clear()
                 for d in range(len(dat)):
                     try:
                         for a in range(len(archd)):# check if exists in database
                             if str(archd[a][5]).upper()==str(dat[d][0]).upper():
                                 raise Exception ('Exists')
                         for b in range(len(stor)):#check if exists if liststore (stor)
                             if str(stor[b][0]).upper()==str(dat[d][0]).upper():
                                 raise Exception ('Exists')
                         stor.append([dat[d][0],dat[d][1],ran[7],dat[d][2],dat[d][3],ran[4],ran[5],ran[6]])
                     except:
                         pass
                 
         except:
             pass
Exemplo n.º 28
0
def setup_cluster(name):
    debug = True
    conn = Conn.Conn(gCtx.opt.cm_host, gCtx.opt.cm_port)
    try:
        conn.do_request('cluster_add %s 0:1' % gCtx.opt.cluster_name, debug)
        conn.do_request('pg_add %s 0' % gCtx.opt.cluster_name, debug)
        conn.do_request('slot_set_pg %s 0:8191 0' % gCtx.opt.cluster_name, debug)
        pm_name = socket.gethostname()
        pm_ip = socket.gethostbyname(pm_name)
        for pgs in gCtx.pgs_ary:
            # pgs_add <cluster_name> <pgsid> <pgid> <pm_name> <pm_ip> <base_port> <backend_port>
            conn.do_request('pgs_add %s %d %d %s %s %d %d' % (gCtx.opt.cluster_name, pgs.id, 0, pm_name, pm_ip, pgs.base_port, pgs.base_port + 9), debug)
            conn.do_request('pgs_join %s %d' % (gCtx.opt.cluster_name, pgs.id), debug)
    except:
        print (sys.exc_info()[0])
        raise
    finally:
        conn.disconnect()
Exemplo n.º 29
0
def main():
    print("Marvellous Infosystems : Python Automation and Machine Learing ")
    print("\n Application name:", sys.argv[0])
    print("+++++++++- Process Monitor -+++++++++")

    if (len(sys.argv) <= 2):
        if (len(sys.argv) == 1):
            print("Error :invalid number of arguments")
            exit()
        if (sys.argv[1] == '-h') or (sys.argv[1] == '-H'):
            print(
                "This script which accept directory name and mail id from user and create log\
file in that directory which contains information of running processes as its name, PID,\
Username. After creating log file send that log file to the specified mail.")
            exit()
        if (sys.argv[1] == '-u') or (sys.argv[1] == '-U'):
            print("Usage : ProcInfoLog.py Demo [email protected]")
            exit()
        else:
            print("Error :invalid number of arguments")
            exit()
    try:

        if mailcheck.check(sys.argv[2]):
            connected = Conn.is_connected()
            if connected:
                start = time.time()
                Listproces = ProcessDisplay()
                filename = ProcessLog(Listproces, sys.argv[1])
                print(filename)
                MailSender(filename, sys.argv[2], time.ctime())
                end = time.time()
                print("Time::", (end - start))
            else:
                print("NO internet Connetion.....")
        else:
            print("Invalied email please enter the valied email")
    except ValueError:
        print("Error : Invalied datatype of input ")
    except Exception:
        print("Error : Invalid input ")
    finally:
        print("Thank You  !!!!!")
Exemplo n.º 30
0
 def setup_class(self):
     engineip = str(cfg.get('Engines', 'engine0'))
     haap_port = cfg.getint('EngineSetting', 'telnet_port')
     password = ''
     timeout = 1.5
     self.haap = Conn.HAAPConn(engineip, haap_port, password, timeout)
Exemplo n.º 31
0
# -*- coding:utf-8 -*-
'''
@author:cuiyb
@Wechat Contact:******
@project:Python
@file:01-查看mysql信息.py
@time:2019/7/27 14:39
'''

import Conn

a = Conn.Link_db()
a.Connect()
Exemplo n.º 32
0
 def _FTP_connect(self):
     self._FTP_Conn = conn.FTPConn(self._host, self._FTPport,
                                   self._FTP_username, self._password,
                                   self._timeout)
Exemplo n.º 33
0
 def editAct(self,widget,path, txt,stor):
     if txt!='' and int(Glob.acc[1])==1:
         stor[path][0]=(txt)
         Glob.act[int(path)][0]=txt
         Conn.conDB().actions(1, stor[path])
Exemplo n.º 34
0
 def editRef(self,widget,path, txt,stor):
     if txt!='' and int(Glob.acc[1])==1:
         stor[path][1]=(txt)
         Glob.ref[int(path)][1]=txt
         Conn.conDB().ref(1, stor[path])
Exemplo n.º 35
0
 def editReg(self,widget,path, txt,stor):
     if txt!=''and int(Glob.acc[1])==1:
         stor[path][0]=(txt)
         Glob.ser[int(path)][0]=txt
         Conn.conDB().ser(1, stor[path])
Exemplo n.º 36
0
 def new(self, widget,event):
     res,stor=new.new().Reg()
     if res==gtk.RESPONSE_OK and stor!=[]:
         Conn.conDB().newEntry(stor)
Exemplo n.º 37
0
 def __init__(self):
     #Glob.init()
     self.back=gtk.Window(gtk.WINDOW_TOPLEVEL)
     try:
         infile=open('conf.dat','r')
         data = cPickle.load(infile)
         infile.close()
         Glob.host=data[0]
         Glob.port=data[1]
         
     except:
         msgbx=gtk.MessageDialog(self.back,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                    gtk.BUTTONS_OK,'System cannot start, Missing Configuration File')
         msgbx.set_decorated(False)
         msgbx.run()
         msgbx.destroy()
         
     Glob.reg=Conn.conDB().reg(0,0)
     Glob.act=Conn.conDB().actions(0,0)
     Glob.ref=Conn.conDB().ref(0,0)
     Glob.ser=Conn.conDB().ser(0,0)
     
     #self.back=gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.back.connect("destroy", lambda wid: gtk.main_quit())
     self.back.set_icon_from_file('BON.jpg')
     self.back.maximize()
     self.back.set_title("Registry")
     self.v=gtk.VBox(False,0)
     self.h=gtk.HBox(False,0)
     self.mbar=gtk.MenuBar()
     menuF=gtk.Menu()
     menuT=gtk.Menu()
     menuR=gtk.Menu()
     self.file=gtk.MenuItem('File')
     self.report=gtk.MenuItem('Reports')
     self.tools=gtk.MenuItem('Tools')
     nw=gtk.MenuItem('New files for Retention')
     nw.connect('button_press_event',self.new)
     cl=gtk.MenuItem('Close')
     cl.connect('button_press_event',self.dest)
     rp=gtk.MenuItem('Reports')
     #rp.connect('button_press_event',self.reports)
     mt=gtk.MenuItem('Material Estimates')
     #mt.connect('button_press_event',self.materials)
     wk=gtk.MenuItem('Duration Estimate')
     #wk.connect('button_press_event',self.Wk_Plan)
     act=gtk.MenuItem('Actions Taken')
     act.connect('button_press_event',self.pref,0)
     ref=gtk.MenuItem('File References')
     ref.connect('button_press_event',self.pref,1)
     reg=gtk.MenuItem('Preferences')
     reg.connect('button_press_event',self.pref,2)
     Acct=gtk.MenuItem('New User Account')
     Acct.connect('button_press_event',self.pref,3)
     menuF.append(nw)
     menuF.append(cl)
     self.file.set_submenu(menuF)
     self.mbar.append(self.file)
     menuR.append(rp)
     menuR.append(mt)
     menuR.append(wk)
     self.report.set_submenu(menuR)
     #self.mbar.append(self.report)
     #menuT.append(act)
     #menuT.append(ref)
     menuT.append(reg)
     self.tools.set_submenu(menuT)
     self.mbar.append(self.tools)
     org=gtk.Label('REGISTRY INFO SYS')
     org.modify_font(pango.FontDescription("sans 18"))
     org.set_size_request(300,35)
     tt=gtk.Table(1,3,False)
     tt.set_size_request(300,40)
     
     btnN=gtk.Button('New')
     btnN.connect('button_press_event',self.new)
     tt.attach(btnN,0,1,0,1)
     
     btnF=gtk.Button('Find')
     btnF.connect('button_press_event',self.find)
     tt.attach(btnF,3,4,0,1)
     self.v.pack_start(self.mbar,False,False,0)
     self.v.pack_start(org,False,True,0)
     self.v.pack_start(tt,False,True,0)
     self.back.add(self.v)
     self.back.show()
     res,acc=log.log().login('Login')
     if res==gtk.RESPONSE_OK:
         try:
             ac=Conn.conDB().acc(0,acc)
             if ac!=[]:
                 Glob.acc=ac
                 menuT.append(Acct)
                 self.back.show_all()
             else:
                 msgbx=gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,
                                         gtk.BUTTONS_OK,'You have entered Either a Wrong User Name or Password,CORRECT ENTRY!! ')
                 msgbx.set_position(gtk.WIN_POS_CENTER)
                 res=msgbx.run()
                 msgbx.destroy()
                 self.destroy()
                 raise Exception('No Account')
         except:
             pass
Exemplo n.º 38
0
 def run(self):
     conn = Conn.Conn(self.host, self.port)
     conn.lazy_connect()
     time.sleep(self.sec)
     conn.disconnect()
Exemplo n.º 39
0
    def __init__(self):
 
        self.conn_=Conn.conn("BJGuahao")
        self.client = BjguahaoClient.BjguahaoClient()
Exemplo n.º 40
0
 def _FTP_connect(self):
     self._FTP_Conn = conn.FTPConn(self._host,
                                   self._FTPport,
                                   'adminftp',
                                   self._password,
                                   self._timeout)