示例#1
0
    def __init__(self, parent):
        wx.Panel.__init__(self,parent,size=(600,700))
        self.func = Datahandler()
        inbox.__init__(self)
        CommonlyUsedMethodes.__init__(self)
        self.font1 = wx.Font(11, wx.DECORATIVE, wx.NORMAL, wx.NORMAL)
        self.panel1 = wx.Panel(self, -1, size=(600, 135))
        self.panel2 = wx.Panel(self, -1, size=(582, 500))
        self.panel2.SetBackgroundColour('White')
        self.label1 = wx.StaticText(self.panel1, -1, "Outbox Messages")
        self.label1.SetFont(self.font1)
        self.update = wx.Button(self.panel1, 101, "Update")
        self.refresh = wx.Button(self.panel1, 102, "Refresh")
        self.delete = wx.Button(self.panel1, 103, "Delete")
        self.deleteAll = wx.Button(self.panel1, 104, "Delete All")
        self.resend = wx.Button(self.panel1, 105, "Resend")
        self.resendAll = wx.Button(self.panel1, 106, "Resend All")
        self.select = wx.Button(self.panel1, 107, "Select All")
        self.select.SetFont(self.font1)
        self.list = ObjectListView(self.panel2,-1,size=(600,435),style = wx.LC_REPORT|wx.SUNKEN_BORDER)

        self.Bind(wx.EVT_BUTTON, self.OnButton, id=101)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=102)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=103)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=104)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=105)
        self.Bind(wx.EVT_BUTTON, self.OnButton, id=106)
        self.Bind(wx.EVT_BUTTON, self.OnSelect, id=107)
        self._DoLayout()       
        self.Init()
示例#2
0
 def _requestFeedback(self, response):
     inbox = InboxManager()
     if response[0] == 'Failure':
         inbox.update(response[2], Identity=['requestFeedback', 'failed'])
         wx.MessageBox(response[1], 'FeedBack', wx.ICON_WARNING)
     else:
         inbox.update(response[2], Identity=['requestFeedback', 'sent'])
         wx.MessageBox('%d sent messages' % len(response[2]), 'FeedBack', wx.ICON_INFORMATION)
示例#3
0
 def _requestFeedback(self,response):        
     inbox = InboxManager()        
     if response[0] == "Failure":
         inbox.update(response[2],Identity=["requestFeedback","failed"])            
         wx.MessageBox(response[1],"FeedBack",wx.ICON_WARNING)
     else:            
         inbox.update(response[2],Identity=["requestFeedback","sent"])
         wx.MessageBox("%d sent messages"%(len(response[2])),
                                                  "FeedBack",wx.ICON_INFORMATION)
示例#4
0
    def _requestFeedback(self,response):
        if self.type == "get users":
            if not os.path.exists("bin/admin"):
                os.mkdir("bin/admin")            
            with open("bin/admin/allusers.dat",'wb') as newfile:
                pickle.dump(response,newfile)
        elif self.type == "update user":
            if response:
                wx.MessageBox("%s"%"Update Successful","Server Response",wx.ICON_INFORMATION)
            else:
                wx.MessageBox("%s"%"Update could not be made","Server Response",wx.ICON_ERROR)                
        elif self.type == "get gname":
            if not os.path.exists("bin/admin"):
                os.mkdir("bin/admin")            
            for i in response[2]:
                fun.add_new_group(i)
            with open("bin/admin/gnames.dat",'wb') as newfile:
                pickle.dump(response[2],newfile)
            
        elif self.type == "get clients":
            response = pickle.loads(response)
            with open("bin/groupclients.dat",'wb') as newfile:
                pickle.dump(response,newfile)            
            style = (response[1],"INFORMATION",wx.ICON_INFORMATION)
            fun.update_gclients()
            box = Printer(style)
            box.messageBox()
        elif self.type == "audit trail":
            response = pickle.loads(response)
            with open("bin/admin/audit.dat",'wb') as newfile:
               pickle.dump(response,newfile)
        elif self.type == "update protocol":
            wx.MessageBox("%s details have been updated"%response,"Server Response",wx.ICON_INFORMATION)
        elif self.type == "get messages":
            if response[0] == "Failure":
                wx.MessageBox("No messeges found","Server Response",wx.ICON_INFORMATION)
            else:
                inbox = InboxManager()
                data1 = {'current':response[1]}
                inbox.write(data1)
                
        elif self.type == "delete messages":
                if response[0] == "Failure":
                    wx.MessageBox("No messages to delete","Server Response",wx.ICON_ERROR)
                else:
                    wx.MessageBox("%s message(s) deleted"%len(response[1]),"Server Response",wx.ICON_INFORMATION)
        elif self.type == "save compd":
                if response:
                    style = ("Success","SERVER RESPONSE",wx.ICON_INFORMATION)
                else:
                    style = ("Failed","SERVER RESPONSE",wx.ICON_ERROR)
                box = Printer(style)
                box.messageBox()
        elif self.type == "add user":
                if response:
                    style = ("Succesfully added new user","SERVER RESPONSE",wx.ICON_INFORMATION)
                else:
                    style = ("Failed to add new user","SERVER RESPONSE",wx.ICON_ERROR)
                box = Printer(style)
                box.messageBox()
        elif self.type == "add check":
                if response:
                    style = ("Success", "SERVER RESPONSE", wx.ICON_INFORMATION)
                else:
                    style = ("Failed to add new user","SERVER RESPONSE",wx.ICON_ERROR)
                box = Printer(style)
                box.messageBox()

        else:        
             if response[0] == "Error":
                     style = (response[1],"ERROR",wx.ICON_ERROR)
             elif response[0] == False:
                     style = (response[1],"ERROR", wx.ICON_ERROR)
             else:
                print response
                style = (response[1],"INFORMATION", wx.ICON_INFORMATION)
             box = Printer(style)
             box.messageBox()
示例#5
0
    def _requestFeedback(self, response):
        if self.type == 'all':
            if isinstance(response, dict):
                for key, value in response.items():
                    file_name = "bin/%s.dat" % key
                    with open(file_name, 'wb') as fl:
                        print >>sys.stdout, "Updating %s" % key
                        pickle.dump(value, fl)
                print time.ctime()
            else:
                print "All details Error"
        elif self.type == 'get users':
            if not os.path.exists('bin/admin'):
                os.mkdir('bin/admin')
            with open('bin/admin/allusers.dat', 'wb') as newfile:
                pickle.dump(response, newfile)
        elif self.type == 'update user':
            if response:
                wx.MessageBox('Update Successful', 'Server Response', wx.ICON_INFORMATION)
            else:
                wx.MessageBox('%s' % 'Update could not be made', 'Server Response', wx.ICON_ERROR)

        elif self.type == 'get groups':
            if not os.path.exists('bin/admin'):
                os.mkdir('bin/admin')
            for i in response[2]:
                fun.add_new_group(i)
            with open('bin/admin/gnames.dat', 'wb') as newfile:
                pickle.dump(response[2], newfile)

        elif self.type == "get outbox":
            with open('bin/outbox.dat', "wb") as fl:
                pickle.dump(response, fl)

        elif self.type == 'get group members':
            response = pickle.loads(response)
            with open('bin/members.dat', 'wb') as newfile:
                pickle.dump(response[2], newfile)
            style = (response[1], 'INFORMATION', wx.ICON_INFORMATION)
            box = Printer(style)
            box.messageBox()

        elif self.type == 'audit trail':
            response = pickle.loads(response)
            with open('bin/admin/audit.dat', 'wb') as newfile:
                pickle.dump(response, newfile)
        elif self.type == 'update protocol':
            wx.MessageBox('%s details have been updated' % response, 'Server Response', wx.ICON_INFORMATION)
        elif self.type == 'get messages':
            if response[0] == 'Failure':
                wx.MessageBox('No messages found', 'Server Response', wx.ICON_INFORMATION)
            else:
                inbox = InboxManager()
                data1 = {'current': response[1]}
                inbox.write(data1)
        elif self.type == 'delete messages':
            if response[0] == 'Failure':
                wx.MessageBox('No messages to delete', 'Server Response', wx.ICON_ERROR)
            else:
                wx.MessageBox('%s message(s) deleted' % len(response[1]), 'Server Response', wx.ICON_INFORMATION)
        elif self.type == 'save compd':
            if response:
                style = ('Success', 'SERVER RESPONSE', wx.ICON_INFORMATION)
            else:
                style = ('Failed', 'SERVER RESPONSE', wx.ICON_ERROR)
            box = Printer(style)
            box.messageBox()
        elif self.type == 'add cheque':
            if response:
                style = ('Success', 'SERVER RESPONSE', wx.ICON_INFORMATION)
            else:
                style = ('Failed to add new user', 'SERVER RESPONSE', wx.ICON_ERROR)
            box = Printer(style)
            box.messageBox()
        else:
            try:
                response[0]
            except TypeError:
                print response
                return

            if response[0] == 'Error':
                style = (response[1], 'ERROR', wx.ICON_ERROR)
            elif not response[0]:
                style = (response[1], 'ERROR', wx.ICON_ERROR)
            else:
                print response
                style = (response[1], 'INFORMATION', wx.ICON_INFORMATION)
            box = Printer(style)
            box.messageBox()