def menuscreen(pdb):
    """
    Creates the main menu look with all the available options which the program can take.
    Prompts the user to select an option from the available options in the Menu.
    Argument: pdb file to update it when file is changed"""

    #Required module
    from mainframe import mainframe

    # Main line parts
    a = " PDB FILE ANALYZER "
    b = " Select an option from below:"
    c = "1) Open a PDB File"
    d = "2) Information"
    e = "3) Show histogram of amino acids"
    f = "4) Display Secondary Structure"
    g = "5) Export PDB File"
    h = "6) Exit"
    i = "Current PDB: "

    # creating the lines ensuring they are equal with length 80
    ln1 = ("     " + ("*" * 80))
    ln2 = ("     " + "*" + a + (" " * (80 - len(a) - 2)) + "*")
    ln3 = ("     " + ("*" * 80))
    ln4 = ("     " + "*" + b + (" " * (80 - len(b) - 2)) + "*")
    ln5 = ("     " + "*" + (" " * 78) + "*")
    ln6 = ("     " + "*" + "     " + c + (" " * (80 - len(c) - 5 - 35)) +
           "(O)" + (" " * 30) + "*")
    ln7 = ("     " + "*" + "     " + d + (" " * (80 - len(d) - 5 - 35)) +
           "(I)" + (" " * 30) + "*")
    ln8 = ("     " + "*" + "     " + e + (" " * (80 - len(e) - 5 - 35)) +
           "(H)" + (" " * 30) + "*")
    ln9 = ("     " + "*" + "     " + f + (" " * (80 - len(f) - 5 - 35)) +
           "(S)" + (" " * 30) + "*")
    ln10 = ("     " + "*" + "     " + g + (" " * (80 - len(g) - 5 - 35)) +
            "(X)" + (" " * 30) + "*")
    ln11 = ("     " + "*" + "     " + h + (" " * (80 - len(h) - 5 - 35)) +
            "(Q)" + (" " * 30) + "*")
    ln12 = ("     " + "*" + (" " * 78) + "*")
    ln13 = ("     " + "*" + (" " * (80 - len(i) - len(pdb) - 3)) + i + pdb +
            " *")
    ln14 = ("     " + ("*" * 80))

    lines = [
        ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8, ln9, ln10, ln11, ln12, ln13,
        ln14
    ]

    print("\n")
    # Read all lines to recreate menu
    for line in lines:
        print(line)

    # prompt user to select an option
    opt = input("     :")
    opt = opt.upper()

    # Call the mainframe function which takes in the options and executes them
    mainframe(opt, pdb)
Example #2
0
from softioc import builder
from mainframe import mainframe
import time
import threading

from datetime import datetime

builder.SetDeviceName("tpc_grid_leak")

#create mainframe object, set telnet port
mf = mainframe(9038)


#_____________________________________________________________________________
def do_monit():
    while True:
        time.sleep(3)
        #print "before: ", datetime.now()
        mf.do_read()
        #print "after: ", datetime.now()


#_____________________________________________________________________________
def loop_monit():
    #initialize lecroy mainframe from config file
    mf.init_config()
    #periodically read measured current and voltage
    tid = threading.Thread(target=do_monit)
    tid.start()
Example #3
0
import wx
import mainframe
#app=wx.App()
#frame=wx.Frame(parent=None,title='ssss')
#frame.Show()
#app.MainLoop()
if __name__=='__main__':
    app=wx.App()
    frame=mainframe.mainframe()
    frame.Show(True)
    app.MainLoop()
Example #4
0
        usernam=raw_input('enter the username')
        passwor=getpass.getpass("enter password")
        que1="select COUNT(1) from authentication where username='******' and password='******'" % (usernam,passwor)
        try:
            cursor.execute(que1)
            res=cursor.fetchone()[0]
        except:
            print 'error'
        if(res==1):
            print 'login sucess'
            que2="select access from authentication where username='******' and password='******'" % (usernam,passwor)
            cursor.execute(que2)
            res2=cursor.fetchone()[0]
            if(res2=='admin'):

                    mf=mainframe()
                    n=raw_input("enter text for values and plot for graph of the cloud result")
                    if(n=="text"):
                        mf.printplot()
                    elif(n=="plot"):
                        mf.plotgraph()



            else:

                      cpuneeded=int(raw_input("enter the cpu needed"))
                      memneeded=int(raw_input("enter the memory needed"))
                      netneeded=int(raw_input("enter the network needed"))
                      mf=mainframe()
                      mt=mf.T
 def create(self):
     db=mys.connect(host='localhost',database='cloud',user='******',password='******')
     cursor=db.cursor()
     mf=mainframe()
     mt=mf.T                    
     #print mt
     tru=[]
     tru1=[]
     for i in range(0,10):
     #tru.append([]
         sum=0
         usum=0
         for j in range(0,4):
            sum=sum+mt[i][j]
         for k in range(4,8):
             usum=usum+mt[i][k]
         tru.append(sum*2)
         tru1.append(usum*2)
     #print tru,tru1
     pi=attack()
     t=pi.action()
     sum=[]
     sec=[]
     for p in range(0,10):
         que="select sec from security where cloudid='%d'" %(p)
         cursor.execute(que)
         res=int(cursor.fetchone()[0])
         sec.append(res)
     for k in range(0,10):
         temp=0
         ct=0
         for ts in t:
             query="select rating from userfeedback where cloudserviceid='%d' and userid='%d'" % (k,ts)
             cursor.execute(query)
             rs=int(cursor.fetchone()[0])
             temp=temp+rs
             ct=ct+1
         res2=float(temp)/float(ct)
         sum.append(res2)
     #print sum
     #print sum
     #sum2=[1,1.5,2,2.5,3,3.5,4,4.5,5]
     #print sum2
     tl=minweight()
     ret=tl.minmax(sum)
     sec1=tl.minmax(sec)
     #print sec1
     #print ret
     #tru=[0.3223603221798172, 0.99, 0.3450511449365403, 0.3192616712523298, 0.11932801544333009, 0.21607115913730365, 0.17092327150084316, 0.01, 0.02322091062394603, 0.47714609035235644]
     #tru1=[0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01]
     #tru=[0.5647694979969955, 0.99, 0.40789496745117676, 0.37726996745117675, 0.13983420443164749, 0.25472396094141214, 0.2011072076865298, 0.01, 0.025703555332999495, 0.5647694979969955]
     #tru1=[0.01, 0.99, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01]
     atp=result()
     favail=[]
     futil=[]
     ffeed=[]
     fsec=[]
     for i in range(0,10):
         tp=atp.rangecalculator("D:\\cloud\\availability.txt",tru[i])
         favail.append(tp)
     for i in range(0,10):
         tp1=atp.rangecalculator("D:\\cloud\\utilisation.txt",tru1[i])
         futil.append(tp1)
     for i in range(0,10):
         tp2=atp.rangecalculator("D:\\cloud\\feedback.txt",ret[i])
         ffeed.append(tp2)
     for i in range(0,10):
         tp3=atp.rangecalculator("D:\\cloud\\security.txt",sec1[i])
         fsec.append(tp3)
     
     fsum=[]
     #print favail,futil,ffeed,fsec
     for i in range(0,10):
         tp4=atp.computeresult(ffeed[i],favail[i],futil[i],fsec[i])
         #print tp4
         fsum.append(tp4)
     #if fsum[0]=='HIGH':
         #print fsum[0]
     #print fsum
     
     #maxi=max(fsum)
     
     #print fsum
     for i in range(0,10):
         bl="insert into trustcloud values('%d','%s')" % (int(i),fsum[i])
         cursor.execute(bl)
         db.commit()
     #print 'commited'
     #System.out.println("commited");'''
     '''mi=minweight()