Beispiel #1
0
 def OnConnect(self, evt):
     if self.list.GetCount() > 0:
         dlg = wx.TextEntryDialog(self,
                                  'Enter WI-FI Password?',
                                  'Connect',
                                  style=wx.TE_PASSWORD | wx.OK | wx.CANCEL)
         dlg.CenterOnParent()
         if dlg.ShowModal() == wx.ID_OK:
             self.g1.Pulse()
             var = dlg.GetValue()
             if len(var) < 8:
                 new = wx.MessageDialog(
                     self,
                     'Password must be 8 or more characters! Please reconnect',
                     'Alert!', wx.OK | wx.ICON_INFORMATION)
                 new.ShowModal()
             else:
                 self.g1.Pulse()
                 new = Network()
                 new.Stop()
                 ssid = self.list.GetStringSelection()
                 key = dlg.GetValue()
                 state = new.Connect(ssid, key)
                 if state == 0:
                     new = wx.MessageDialog(
                         self,
                         'Password not correct or network not found again!',
                         'Error Connecting!', wx.OK | wx.ICON_INFORMATION)
                     new.ShowModal()
                 else:
                     self.g1.Pulse()
                     time.sleep(3)
                     new = Network()
                     ip = new.GetJoinIP()
                     reactor.connectTCP(str(ip), 8000, ClientFactory())
Beispiel #2
0
 def OnReconnect(self, evt):
     j = self.peers.GetCount()
     if j < 1:
         new = Network()
         ip = new.GetJoinIP()
         reactor.connectTCP(str(ip), 8000, ClientFactory())
     else:
         pass