本文整理汇总了Python中gui.MainWindow.update_statusbar方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.update_statusbar方法的具体用法?Python MainWindow.update_statusbar怎么用?Python MainWindow.update_statusbar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.MainWindow
的用法示例。
在下文中一共展示了MainWindow.update_statusbar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gui import MainWindow [as 别名]
# 或者: from gui.MainWindow import update_statusbar [as 别名]
#.........这里部分代码省略.........
for data in self.client_thread.get_queue("source"):
uuid = data["uuid"]
if uuid == "00000000-0000-0000-0000-000000000000":
continue
self.sources[uuid] = data
update = True
if update is True:
self.main_window.update_sources_table(self.sources)
return True
def queue_handler_networks(self):
#ssid
for data in self.client_thread.get_queue("ssid"):
self.networks.add_ssid_data(data)
#bssid
bssids = {}
for data in self.client_thread.get_queue("bssid"):
mac = data["bssid"]
self.networks.add_bssid_data(data)
if mac in self.main_window.signal_graphs and "signal_dbm" not in self.client_thread.client.capabilities["bssidsrc"]:
self.main_window.signal_graphs[mac].add_value(None, None, data["signal_dbm"])
bssids[mac] = True
#bssidsrc
for data in self.client_thread.get_queue("bssidsrc"):
if "signal_dbm" not in data or data["uuid"] not in self.sources:
continue
mac = data["bssid"]
if mac in self.main_window.signal_graphs:
self.main_window.signal_graphs[mac].add_value(self.sources[data["uuid"]], data, data["signal_dbm"])
if len(self.networks.notify_add_queue) > 0:
self.networks.start_queue()
if len(self.networks.notify_add_queue) > 500:
self.networks.disable_refresh()
self.main_window.networks_queue_progress()
self.main_window.update_statusbar()
return True
def quit(self):
self.client_thread.stop()
self.config_handler.write()
self.networks.save(self.networks_file)
def get_battery_capacity(self):
filename = "/proc/acpi/battery/%s/state" % self.battery
if not os.path.isfile(filename):
return False
f = open(filename)
for line in f.readlines():
if line.startswith("remaining capacity:"):
current = line.split(":")[1].strip()
current = int(current.split()[0])
return round(100.0 / self.battery_max * current, 1)
return False
def update_battery_bar(self):
battery = self.get_battery_capacity()
self.main_window.set_battery_bar(battery)
return True
def add_network_to_map(self, mac):
network = self.networks.get_network(mac)
try:
crypt = self.crypt_cache[network["cryptset"]]
except KeyError:
crypt = decode_cryptset(network["cryptset"], True)
self.crypt_cache[network["cryptset"]] = crypt
if "WPA" in crypt:
color = "red"
elif "WEP" in crypt:
color = "orange"
else:
color = "green"
ssid = network["ssid"]
if ssid == "":
ssid = "<no ssid>"
evils = (("&", "&"),("<", "<"),(">", ">"))
for evil, good in evils:
ssid = ssid.replace(evil, good)
time_format = "%d.%m.%Y %H:%M:%S"
text = self.marker_text % (crypt, mac, network["manuf"],
network["type"], network["channel"],
time.strftime(time_format, time.localtime(network["firsttime"])),
time.strftime(time_format, time.localtime(network["lasttime"]))
)
text = text.replace("&", "&")
self.map.add_marker(mac, color, network["lat"], network["lon"])
示例2: __init__
# 需要导入模块: from gui import MainWindow [as 别名]
# 或者: from gui.MainWindow import update_statusbar [as 别名]
#.........这里部分代码省略.........
#status
for data in thread.get_queue("status"):
self.main_window.log_list.add(server_name, data["text"])
#info
info_queue = thread.get_queue("info")
try:
data = info_queue.pop()
self.main_window.server_tabs[server_id].update_info_table(data)
except IndexError:
pass
#source
update = False
for data in thread.get_queue("source"):
uuid = data["uuid"]
if uuid == "00000000-0000-0000-0000-000000000000":
continue
self.sources[server_id][uuid] = data
update = True
if update is True:
self.main_window.server_tabs[server_id].update_sources_table(self.sources[server_id])
def queues_handler(self):
for server_id in self.client_threads:
self.queue_handler(server_id)
return True
def queue_handler_networks(self, server_id):
thread = self.client_threads[server_id]
#ssid
for data in thread.get_queue("ssid"):
self.networks.add_ssid_data(data)
#bssid
bssids = {}
for data in thread.get_queue("bssid"):
mac = data["bssid"]
self.networks.add_bssid_data(data, server_id)
if mac in self.main_window.signal_graphs and "signal_dbm" not in thread.client.capabilities["bssidsrc"]:
self.main_window.signal_graphs[mac].add_value(None, None, data["signal_dbm"], server_id)
bssids[mac] = True
#bssidsrc
for data in thread.get_queue("bssidsrc"):
if "signal_dbm" not in data or data["uuid"] not in self.sources[server_id]:
continue
mac = data["bssid"]
if mac in self.main_window.signal_graphs:
self.main_window.signal_graphs[mac].add_value(self.sources[server_id][data["uuid"]], data, data["signal_dbm"], server_id)
if len(self.networks.notify_add_queue) > 0:
self.networks.start_queue()
if len(self.networks.notify_add_queue) > 500:
self.networks.disable_refresh()
self.main_window.networks_queue_progress()
self.main_window.update_statusbar()
def queues_handler_networks(self):
for server_id in self.client_threads:
self.queue_handler_networks(server_id)
return True
def quit(self):
self.clients_stop()
lat = self.map.osm.get_property("latitude")
lon = self.map.osm.get_property("longitude")
self.config["map"]["last_position"] = "%.6f/%.6f" % (lat, lon)
while None in self.config['kismet']['servers']:
self.config['kismet']['servers'].remove(None)
self.config_handler.write()
self.networks.save(self.networks_file, force=True)
def add_network_to_map(self, mac):
network = self.networks.get_network(mac)
try:
crypt = self.crypt_cache[network["cryptset"]]
except KeyError:
crypt = decode_cryptset(network["cryptset"], True)
self.crypt_cache[network["cryptset"]] = crypt
if "AES_CCM" in crypt or "AES_OCB" in crypt:
color = "red"
elif "WPA" in crypt:
color = "orange"
elif "WEP" in crypt:
color = "yellow"
else:
color = "green"
self.map.add_marker(mac, color, network["lat"], network["lon"])