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 OnCreate(self, evt):
     ran = Random()
     ran = ran.Generate()
     if self.jdata['password'] != "": ran = self.jdata['password']
     network = Network()
     network.Stop()
     ssid = self.ssid.GetValue()
     if ssid == "":
         dlg = wx.MessageDialog(self, 'Please enter a value!', 'Alert!',
                                wx.OK | wx.ICON_INFORMATION)
         dlg.ShowModal()
         dlg.Destroy()
     else:
         try:
             network.Create(ssid, ran)
             self.display.SetLabel('Network Password is: %s' % (ran))
             self.display.AppendText('\nWaiting for peers to join...')
             get = Network()
             time.sleep(3)
             ip = get.GetCreateIP()
             reactor.listenTCP(8000, ServerFactory(), interface=str(ip))
         except:
             dlg = wx.MessageDialog(
                 self,
                 'Sorry an error was found. Make sure you are running this application with administrative priviledge. '
                 'This could also be caused by network driver issues. Click on the about Info-button to get help',
                 'Error Detected', wx.OK | wx.ICON_ERROR)
             dlg.ShowModal()
             dlg.Destroy()
             self.Destroy()
Beispiel #3
0
 def OnCloseWindow(self, evt):
     pub.sendMessage("closewindow", msg="")
     new = Network()
     new.Stop()
     self.Destroy()
Beispiel #4
0
 def CancelNet(self, evt):
     network = Network()
     network.Stop()
     self.display.SetLabelText("Network stopped.")