'stop all thread :Access point attack and restore all settings'

def Stop_PumpAP(self):

    if (self.Apthreads['RougeAP'] == []):
        return
    print '-------------------------------'
    self.ProxyPluginsTAB.GroupSettings.setEnabled(True)
    self.FSettings.Settings.set_setting('accesspoint', 'statusAP', False)
    self.SessionsAP[self.currentSessionID]['stoped'] = asctime()
    self.FSettings.Settings.set_setting('accesspoint', 'sessions', dumps(self.SessionsAP))
    self.PumpSettingsTAB.GroupArea.setEnabled(True)
    try:
        for thread in self.Apthreads['RougeAP']:
            thread.stop()
            if hasattr(thread, 'wait'):
                if (not thread.wait(msecs=500)):
                    thread.terminate()
    except Exception:
        pass
    for kill in self.SettingsAP['kill']:
        Popen(split(kill), stdout=PIPE, shell=False, stderr=PIPE)
    set_monitor_mode(self.SettingsEnable['AP_iface']).setDisable()
    self.Started(False)
    self.progress.setValue(1)
    self.progress.change_color('')
    self.connectedCount.setText('0')
    self.Apthreads['RougeAP'] = []
    self.APclients = {}
    lines = []
    if (self.ProxyPluginsTAB.log_inject.count() > 0):
        with open('logs/AccessPoint/injectionPage.log', 'w') as injectionlog:
            for index in xrange(self.ProxyPluginsTAB.log_inject.count()):
                lines.append(str(self.ProxyPluginsTAB.log_inject.item(index).text()))
            for log in lines:
                injectionlog.write((log + '\n'))
            injectionlog.close()
    with open('/var/lib/dhcp/dhcpd.leases', 'w') as dhcpLease:
        (dhcpLease.write(''), dhcpLease.close())
    self.btn_start_attack.setDisabled(False)
    Refactor.set_ip_forward(0)
    self.TabInfoAP.clearContents()
    self.THeaders = OrderedDict([('Devices', []), ('Mac    Address', []), ('IP    Address', []), ('Vendors', [])])
    if hasattr(self.FormPopup, 'Ftemplates'):
        self.FormPopup.Ftemplates.killThread()
        self.FormPopup.StatusServer(False)
    self.EditApName.setEnabled(True)
    self.selectCard.setEnabled(True)
    self.EditChannel.setEnabled(True)
    self.GroupApPassphrase.setEnabled(True)
    self.PumpSettingsTAB.GroupDHCP.setEnabled(True)
    self.PopUpPlugins.tableplugins.setEnabled(True)
    self.PopUpPlugins.tableplugincheckbox.setEnabled(True)
    self.btn_cancelar.setEnabled(False)
    self.progress.showProcessBar()
