Skip to content

Commit

Permalink
updated npcap link + 1 bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaharX97 committed Dec 8, 2020
1 parent 788648b commit f79cc10
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
20 changes: 14 additions & 6 deletions MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,23 @@ def _addto_watchlist(self):
if len(to_add):
try:
rfile = open(g.exec_path + "watchlist", "r", encoding="utf-8")
for line in rfile:
player = WP.MyWatchPlayer(line)
if player.link in to_add:
to_add.remove(player.link)
if not len(to_add):
break
except FileNotFoundError:
tempwrite = open(g.exec_path + "watchlist", "w", encoding="utf-8")
tempwrite.close()
try:
rfile = open(g.exec_path + "watchlist", "r", encoding="utf-8")
except:
AW.MyAlertWindow(self.window, "Error opening WatchList (read)")
return
except Exception:
AW.MyAlertWindow(self.window, "Error opening WatchList (read)")
return
for line in rfile:
player = WP.MyWatchPlayer(line)
if player.link in to_add:
to_add.remove(player.link)
if not len(to_add):
break
try:
rfile.close()
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions WatchListWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def __init__(self, root):
try:
self.rfile = open(g.exec_path + "watchlist", "r", encoding="utf-8")
except FileNotFoundError:
self.rfile = open(g.exec_path + "watchlist", "w", encoding="utf-8")
self.rfile.close()
tempwrite = open(g.exec_path + "watchlist", "w", encoding="utf-8")
tempwrite.close()
self.rfile = open(g.exec_path + "watchlist", "r", encoding="utf-8")
self.findex = 1
self._lastpage = 0
Expand Down
22 changes: 21 additions & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ def check_npcap(window):
return True
except RuntimeError:
AW.MyAlertWindow(window.window,
"Can't find npcap. Get it from " + g.npcap_link +
"Can't find npcap. Get it from: " + g.npcap_link +
"\nPress the DOWNLOAD button to go to the link")
window.entry1_url.text.set(g.npcap_link)
window.label3_time.text.set("npcap error")
return False
except:
AW.MyAlertWindow(window.window,
"Unknown npcap error. Try to reinstall or get the latest version from: \n" + g.npcap_link +
"\nPress the DOWNLOAD button to go to the link")
window.entry1_url.text.set(g.npcap_link)
window.label3_time.text.set("npcap error")
Expand Down Expand Up @@ -205,6 +212,7 @@ def analyze_demo(path, button):
g.demo_stats.subscribe_to_event("gevent_round_officially_ended", my.round_officially_ended)
g.demo_stats.subscribe_to_event("parser_update_pinfo", my.update_pinfo)
g.demo_stats.subscribe_to_event("cmd_dem_stop", my.cmd_dem_stop)
# g.demo_stats.subscribe_to_event("parser_new_tick", analyze_progress(button))
try:
g.demo_stats.parse()
except Exception:
Expand All @@ -226,6 +234,12 @@ def open_link(link, button):
# global g.browser_path, g.thread_download
if link == "":
return
if link == g.npcap_link:
if g.browser_path is None:
web.open_new_tab(link)
else:
sp.Popen(g.browser_path + " " + link)
return
link = "http://" + link
if g.thread_download.is_alive() or g.thread_analyze.is_alive():
AW.MyAlertWindow(g.app.window, "Download or analyze in progress, please wait!")
Expand Down Expand Up @@ -320,5 +334,11 @@ def actual_check_vac():
AW.MyAlertWindow(g.app.window, text)


def analyze_progress(btn):
def analyze_progress2(data):
btn.text.set("analyzing... {} %".format(int(data)))
return analyze_progress2


def placeholder():
print("test")
2 changes: 1 addition & 1 deletion myglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
exec_path = None
demo_stats = None
demo_nrplayers = 10
npcap_link = "https://nmap.org/npcap/dist/npcap-0.9988.exe"
npcap_link = "https://nmap.org/npcap/"
found_time = None
thread_sniff = t.Thread()
thread_download = t.Thread()
Expand Down

0 comments on commit f79cc10

Please sign in to comment.