Beispiel #1
0
 def inner(*args, **kwargs):  # 可变参数
     _username = "******"
     _password = "******"
     _managername = 'peiqi'
     _managerword = '321'
     global user_status
     if user_status == False:
         username = input("用户名:")
         password = input("密码:")
         if username == _username and password == _password:
             print("欢迎....")
             user_status = True
         elif username == _managername and password == _managerword:
             print("欢迎管理者...")
             user_status = True
             manager()
         else:
             print("输入有误")
     if user_status == True:
         fun(*args, **kwargs)
Beispiel #2
0
    def displayy(self):

        self.userid = self.txtusername.text()
        self.userpass = self.txtpass.text()
        con = db.createconnection()
        query = "select UserId,Password from manager where UserId=%s && Password=%s"
        cursor = con.cursor()
        a = cursor.execute(query,(self.userid,self.userpass))

        rows=cursor.fetchone()

        if(a):
            self.o=manager()
            self.o.show()
            self.o.lbluser.setText(self.userid)
            self.close()
            # self.showMessage("Congratulations !!!  You are successfully logged in\n\nClick ok to continue       ")
        elif self.userid.__eq__("") | self.userpass.__eq__(""):
            self.showMessage1("User Id or password can not be blank")
        else:
            self.showMessage1("Invalid User Id and password")
Beispiel #3
0
from manager import *
from sys import argv

user = ['1', 'sebas', '1197sebas']
scriptName, deviceName, IP = argv
manager = manager()

device = ['1', IP, deviceName]
devices = []
devices.append(device)
connections = manager.createConnections(devices, user)
dbHost = 'localhost'
username = '******'
password = '******'
dataBaseName = 'mydb'
dataBase = dbConnection(dbHost, username, password, dataBaseName)
dataBase.connect()
query = "insert into dispositivo(nombre,tipo,users_idusers) values ('" + deviceName + "','router',1);"
dataBase.execute(query)
dataBase.disconnect()
Beispiel #4
0
    def handle(self):
        con = self.con
        info = self.info
        try:
            uuid = info.getHeader('Unique-ID')
            dial_str = info.getHeader('variable_dial_str')
            context = info.getHeader('caller-context')
            dest = info.getHeader('channel-destination-number')
            domain = get_domain(info)
            con.events('plain', 'all')
            con.filter('Unique-ID', uuid)
            # con.send('myevents plain {}'.format(uuid))
            ev = con.recvEventTimed(2000)
            if ev and uuid != ev.getHeader('Unique-ID'):
                print('#######不一样的event')
            '''
			按照wiki所说,context是系统的通道变量,它对应于info变量是caller-context,但是dialplan里设置了context=internal,
			发出的事件里的caller-context没变,而是多了一个caller-context自定义的event字段。
			程序里先获取caller-context字段,如果能获取到,说明拨号计划里期望更改默认的context,则使用获取到的值
			否则再获取caller-context并使用之
			'''
            if context == 'call_out':
                if dest in ['000', 'login']:
                    login(con)
                elif dest in ['001', 'logout']:
                    logout(con)
                elif dest == '002':
                    queue_query_number(con)
                elif len(dest) == 3:
                    manager(con)
                # 下面这条测试,通过web originate(...)外呼或者软电话外呼
                elif (dest.isdigit() and 8 < len(dest) < 13
                      and dest[0:3] != '888') or dest in ['call-out']:
                    dial_str, callee, caller, staff_id, uuid = call_out(con)
                    if dial_str:
                        set_variable(con, 'CDR(DIALSTATUS)', 'answered')
                        con.executeAsync('bridge', dial_str)
                        records(con, callee, caller, staff_id, uuid)
                elif dest in ['003', 'onhold']:
                    call_onhold(con)
                elif dest in map(str, range(8800, 8819)) + [
                        'internal', '88851063330', '88851063331'
                ]:
                    dial_str, queue_name = call_in(con)
                    if dial_str or queue_name:
                        set_variable(con, 'CDR(DIALSTATUS)', 'answered')
                    if dial_str:
                        con.executeAsync('bridge', dial_str)
                    elif queue_name:
                        staff_id, member = report_staffid(con)
                        queue_bridge(con.executeAsync, staff_id, domain,
                                     queue_name)

                # 下面是呼入的场景(呼入到web端坐席?)
                elif dest in ['004', 'from-web']:
                    u_queue = web_call(con)
                    if u_queue:
                        staff_id, member = report_staffid(con)
                        queue_bridge(con.executeAsync, staff_id, domain,
                                     u_queue)
                elif dest == 'from-ivr':  #这里是web originate发起后走到到流程,originate必须设置参数my_caller, my_callee
                    caller = info.getHeader('variable_my_caller')
                    callee = info.getHeader('variable_my_callee')
                    records(con, callee, caller, domain, uuid)
                    u_queue = info.getHeader('variable_U_QUEUE')
                    if u_queue:
                        staff_id, member = report_staffid(con)
                        queue_bridge(con.executeAsync, staff_id, domain,
                                     u_queue)
                elif dest in ['006', 'from-autocall']:
                    caller = info.getHeader('variable_my_caller')
                    callee = info.getHeader('variable_my_callee')
                    records(con, callee, caller, domain, uuid)
                    queue_name = info.getHeader('variable_QueueName')
                    if queue_name:
                        staff_id = queue_answer(con, info)
                        queue_bridge(con.executeAsync, staff_id, domain,
                                     queue_name)
                elif dest == '_asr':
                    dial_str, queue_name = call_in(con)
                    if dial_str or queue_name:
                        set_variable(con, 'CDR(DIALSTATUS)', 'answered')
                    if dial_str:
                        con.executeAsync('bridge', dial_str)
                    elif queue_name:
                        staff_id, member = report_staffid(con)
                        queue_bridge(con.executeAsync, staff_id, domain,
                                     queue_name)

                elif dest in ['postprocess-after-autocall', '678']:
                    callee = info.getHeader('variable_my_callee')
                    share_string = info.getHeader('SHARED(SHARE_STRING)')
                    queue_save_number(con, callee, share_string)
        except SystemExit:
            print('调用了exit(0)')
        except Exception as e:
            print('e')
        finally:
            # con.execute('sleep', '20000')
            # con.setEventLock('1')
            con.disconnect()
Beispiel #5
0
                               [int(b.pos[0] * util.scale),
                                math.ceil((util.b_h - b.pos[1]) * util.scale)],
                               math.ceil(util.L * util.scale))
    pygame.display.flip()


temps = []

while simulation:
    ev = pygame.event.get()
    for event in ev:
        # Quitter
        if event.type == pygame.QUIT:
            simulation = False

    if not manager.fini():

        util.tau = util.tau_0 - util.time % util.tau_0
        if util.tau < 10 ** -5:
            util.tau = util.tau + util.tau_0

        manager()

        util.time = util.time + manager.lastTau
        temps.append(util.time)

    drawboard()
    clock.tick(40)

print("Avantage : " + str(manager.getAvantage()))
Beispiel #6
0
    def __init__(self, *args, **kwds):
        """The Intialization of the window frame and it's widgets and window events"""
        # begin wxGlade: toDoList.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        # Menu Bar
        self.toDoList_menubar = wx.MenuBar()
        self.SetMenuBar(self.toDoList_menubar)
        self.CreateStatusBar()
        menuBar = wx.Menu()
        menuBar.Append(ID_EXPORT, "Export", "Save file", wx.ITEM_NORMAL)
        menuBar.Append(ID_EXIT, "Exit", "Toodles (^_^)y", wx.ITEM_NORMAL)
        self.toDoList_menubar.Append(menuBar, "File")
        menuBar = wx.Menu()
        menuBar.Append(ID_HOWTO, "How To", "Instructions on how to use the task list", wx.ITEM_NORMAL)
        menuBar.Append(ID_ABOUT, "About", "Credits", wx.ITEM_NORMAL)
        self.toDoList_menubar.Append(menuBar, "Help")
        # Menu Bar end
        # -- DateBlock --- Date Selection
        self.previous = wx.Button(self, -1, "Previous")
        self.datepicker = wx.DatePickerCtrl(self, -1, style=wx.DP_DROPDOWN)
        self.next = wx.Button(self, -1, "Next")
        # -- sizer_2 -- ListCtrl Cal_ControlList - The date's tasks
        listID = wx.NewId()
        self.Cal_ControlList = wx.ListCtrl(self, listID, style=wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES|wx.SUNKEN_BORDER)
        # -- EntryData -- Edit(Add) Entry Panel
        #Check box to complete an event
        self.isComplete = wx.CheckBox(self, -1, "")
        #Entry box for Title of event
        self.title = wx.TextCtrl(self, -1, "")
        #location label "takes place at":
        self.at = wx.StaticText(self, -1, "     at ")
        #Entry box for the location
        self.location = wx.TextCtrl(self, -1, "")

        #--Block for determining the time of an event--
        #Label with extra spaces preceeding to buffer between text and location box:
        self.Time = wx.StaticText(self, -1, "      Time:", style=wx.ALIGN_CENTRE)
        #Hours 0-23; 24-hour clock:
        self.hour = wx.SpinCtrl(self, -1, "", min=-1, max=23)
        self.hour.SetValue(-1)
        #Minutes 0-59:
        self.min = wx.SpinCtrl(self, -1, "", min=-1, max=59)
        self.min.SetValue(-1)
        #Durations available in 15 minutes intervals:
        self.duration = wx.ComboBox(self, -1, choices=["", "15", "30", "45", "60", "75", "90", "105", "120", "135", "150", "165", "180", "195", "210", "225", "240", "255", "270", "285", "300"], style=wx.CB_DROPDOWN)
        #duration label (so the user knows what the box is for)
        #w/extra @ the end to make space for the submit button:
        self.inMinutes = wx.StaticText(self, -1, "minutes long   ")
        self.submit = wx.Button(self,wx.NewId(),"Submit")
        self.edit = wx.Button(self,wx.NewId(),"Edit")
        self.remove = wx.Button(self,wx.NewId(),"Remove")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
        #intialize list control columns
        self.Cal_ControlList.InsertColumn(0,"Complete?",)
        self.Cal_ControlList.InsertColumn(1,"Title")
        self.Cal_ControlList.InsertColumn(2,"Location")
        self.Cal_ControlList.InsertColumn(3,"Time")
        self.Cal_ControlList.InsertColumn(4,"Duration")
        # event - selecting (or deselecting) an entry to show on EntryData sizer on click
        self.currentItem = 0
        wx.EVT_LIST_ITEM_SELECTED(self, listID, self.onItemSelected)
        wx.EVT_LIST_ITEM_DESELECTED(self, listID, self.onItemDeselected)
        wx.EVT_LEFT_DCLICK(self.Cal_ControlList, self.onDoubleClick)
        # event - submitting an entry to the listctrl Cal_ControlList
        wx.EVT_BUTTON(self,self.submit.GetId(), self.pushSubmit)
        wx.EVT_BUTTON(self,self.edit.GetId(),self.pushEdit)
        wx.EVT_BUTTON(self,self.remove.GetId(),self.pushRemove)
        # event - changing a date
        wx.EVT_BUTTON(self,self.previous.GetId(),self.pushPrev)
        wx.EVT_BUTTON(self,self.next.GetId(),self.pushNext)
        wx.EVT_DATE_CHANGED(self, self.datepicker.GetId(),self.dateChanged)
        # event - menu events : export, exit, howto, about
        wx.EVT_MENU(self, ID_EXIT, self.exitCal)
        wx.EVT_MENU(self, ID_HOWTO, self.onHowTo)
        wx.EVT_MENU(self, ID_ABOUT, self.onAbout)
        wx.EVT_MENU(self, ID_EXPORT, self.onExport)


        ###SETUP DATA STRUCTURE###
        self.m = manager()

        #update view on listctrl at the end.("garbage collection")
        self.updateView()