def __init__(self, root, newver, oldver): self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("New Version Available") self.window.minsize(150, 80) self.window.resizable(False, False) self.window.attributes("-topmost") self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.label = btk.MyLabelStyle( self.window, "Newer version (v{}) available!\nYou have v{}".format( newver, oldver)) self.label.frame.grid(row=0, column=0, columnspan=2, padx=5, pady=5) self.btn_close = btk.MyButtonStyle(self.window, "Ignore", self.window.destroy) self.btn_close.btn.grid(row=1, column=0, padx=5, pady=5, sticky=tk.E + tk.W) self.btn_close = btk.MyButtonStyle( self.window, "Download", lambda: [ f.open_link(g.PROJECT_LINK_LATEST, None, True), self.window.destroy() ]) self.btn_close.btn.grid(row=1, column=1, padx=5, pady=5, sticky=tk.E + tk.W) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root): self.window = tk.Toplevel(root.window) self.window.transient(root.window) self.window.title("Extra Stuff") # self.window.minsize(100, 50) self.window.resizable(False, False) self.window.attributes("-topmost") self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.btn_close = btk.MyButtonStyle( self.window, "More Stats", lambda: [root._open_more_stats(), self.window.destroy()]) self.btn_close.btn.pack(padx=5, pady=5) self.btn_close = btk.MyButtonStyle( self.window, "Export WL (CSV)", lambda: [ root.close_and_update(), f.export_wl_csv(self.window), self.window.destroy() ]) self.btn_close.btn.pack(padx=5, pady=5) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root.window, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root): self.window = tk.Toplevel(root.window) self.window.transient(root.window) self.window.title("Check Vac") self.window.minsize(150, 80) self.window.resizable(False, False) self.window.attributes("-topmost") self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.label = btk.MyLabelStyle(self.window, "What to check?") self.label.frame.grid(row=0, column=0, columnspan=2, padx=5, pady=5) self.btn_30 = btk.MyButtonStyle(self.window, "Last 30 players", lambda: self.checkk(root, 30)) self.btn_30.btn.grid(row=1, column=0, padx=5, pady=5, sticky=tk.E + tk.W) self.btn_all = btk.MyButtonStyle(self.window, "Check all", lambda: self.checkk(root, 0)) self.btn_all.btn.grid(row=1, column=1, padx=5, pady=5, sticky=tk.E + tk.W) self.label2 = btk.MyLabelStyle(self.window, "Delay in ms:") self.label2.frame.grid(row=2, column=0, padx=5, pady=5) self.entry_speed = btk.MyEntryStyle(self.window, str(g.settings_dict["vac_delay"])) self.entry_speed.frame.config(state="normal") self.entry_speed.frame.grid(row=2, column=1, sticky=tk.W + tk.E, padx=5) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root.window, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root, message, title="error"): self.window = tk.Toplevel(root) self.window.transient(root) self.window.title(title) self.window.minsize(100, 50) self.window.resizable(False, False) self.window.attributes("-topmost") self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.label = btk.MyLabelStyle(self.window, message) self.label.frame.pack() self.btn_close = btk.MyButtonStyle(self.window, "Close", self.window.destroy) self.btn_close.btn.pack() self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root): self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("Settings") self.window.minsize(580, 330) sizex = self.window.minsize()[0] # sizey = self.window.minsize()[1] self.window.resizable(False, False) self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self._destroy_checkname) self.label_set1 = btk.MyLabelStyle(self.window, "Stop scanning after a DEMO LINK is found") self.label_set1.frame.grid(row=0, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set1 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set1), "stop_label") self.btn_set1.btn.grid(row=0, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set5 = btk.MyLabelStyle(self.window, "Auto download DEMO after a LINK is found") self.label_set5.frame.grid(row=1, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set5 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set5), "auto_dl") self.btn_set5.btn.grid(row=1, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set2 = btk.MyLabelStyle(self.window, "Use the browser to download (doesn't work with auto download)") self.label_set2.frame.grid(row=2, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set2 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set2), "browser_dl") self.btn_set2.btn.grid(row=2, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set3 = btk.MyLabelStyle(self.window, "*" * 50 + "Download location when not using the browser" + "*" * 50) self.label_set3.frame.config(width=45) self.label_set3.frame.grid(row=3, column=0, sticky=tk.W + tk.E, pady=5, columnspan=4) self.btn_browse = btk.MyButtonStyle(self.window, "Browse", self._set_download_path) self.btn_browse.btn.grid(row=4, column=0, sticky=tk.W + tk.E, padx=5) self.entry_browse = btk.MyEntryStyle(self.window, g.settings_dict["dl_loc"]) self.entry_browse.frame.grid(row=4, column=1, sticky=tk.W + tk.E, padx=5, columnspan=2) self.btn_opendl = btk.MyButtonStyle(self.window, "Open", lambda: os.system("start {}".format(g.settings_dict["dl_loc"]))) self.btn_opendl.btn.grid(row=4, column=3, sticky=tk.E, padx=5, pady=5) self.label_set3_1 = btk.MyLabelStyle(self.window, "*" * 200) self.label_set3_1.frame.config(width=45) self.label_set3_1.frame.grid(row=5, column=0, sticky=tk.W + tk.E, columnspan=4) self.label_set4 = btk.MyLabelStyle(self.window, "Rename downloaded demos to ") self.label_set4.frame.grid(row=6, column=1, sticky=tk.W, padx=5, pady=5) self.btn_set3 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set3), "rename_dl") self.btn_set3.btn.grid(row=6, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.entry_demo = btk.MyEntryStyle(self.window, g.settings_dict["rename"]) self.entry_demo.frame.config(state="normal") self.entry_demo.frame.grid(row=6, column=2, sticky=tk.W + tk.E, padx=5, columnspan=2) self.label_set6 = btk.MyLabelStyle(self.window, "Auto delete DEMO after it is analyzed") self.label_set6.frame.grid(row=7, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set6 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set6), "delete_after") self.btn_set6.btn.grid(row=7, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.btn_save = btk.MyButtonStyle(self.window, "Save to file", self._update_on_save) self.btn_save.btn.grid(row=8, column=3, sticky=tk.E, padx=5, pady=5) self.btn_analyze = btk.MyButtonStyle(self.window, "Analyze a demo", self._analyze_demo) self.btn_analyze.btn.grid(row=8, column=0, columnspan=2, sticky=tk.W, padx=5, pady=5) def lc_event1(event): link = self.label_github.text.get() if len(link) == 0: return if g.browser_path is None: web.open_new_tab(link) else: sp.Popen(g.browser_path + " " + link) self.label_github = btk.MyLabelStyle(self.window, "https://github.com/ZaharX97/OWReveal") self.label_github.frame.config(cursor="hand2") self.label_github.frame.grid(row=8, column=1, padx=5, pady=5, columnspan=2) self.label_github.frame.bind("<Button-1>", lc_event1) self._update_all_settings() self.window.grid_columnconfigure(0, minsize=0.15 * sizex, weight=1) self.window.grid_columnconfigure(1, minsize=0.5 * sizex, weight=1) self.window.grid_columnconfigure(2, minsize=0.15 * sizex, weight=1) self.window.grid_columnconfigure(3, minsize=0.2 * sizex, weight=1) self.window.grid_propagate(False) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
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() self.rfile = open(g.exec_path + "watchlist", "r", encoding="utf-8") self.findex = 1 self._lastpage = 0 self._maxpages = 0 self._stats = {} self.watchlist = [] self.to_remove = set() self.to_ban = set() self.to_comm = set() self.comm_dict = {} self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("WatchList") self.window.minsize(750, 430) # self.window.resizable(False, False) sizex = self.window.minsize()[0] self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.close_and_update) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, " \\") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=0, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, " ##") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=1, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "NAME") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=2, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "KAD") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=3, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "MAP") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=4, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "DATE ADDED") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=5, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "COMMENTS") label.frame.config(font=("", 12, "bold")) label.frame.grid(row=0, column=6, padx=5, sticky=tk.W + tk.E) # frame.grid_columnconfigure(0, minsize=0.002 * sizex, weight=1) # frame.grid_columnconfigure(1, minsize=0.002 * sizex, weight=1) frame.grid_columnconfigure(2, minsize=0.27 * sizex, weight=1) frame.grid_columnconfigure(3, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(4, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(5, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(6, minsize=0.2 * sizex, weight=1) frame.grid_propagate(False) frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, "_" * 300) label.frame.pack() frame.pack_propagate(False) frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=300) def lc_event1(event): for item in self.watchlist: if item["name"].frame == event.widget: link = item["player"].link if item[ "player"] is not None else None break if link is None or len(link) == 0: return if g.browser_path is None: web.open_new_tab(link) else: sp.Popen(g.browser_path + " " + link) for i2 in range(1, 11): check = btk.MyCheckButtonStyle(frame) check.btn.grid(row=i2 - 1, column=0) numberr = btk.MyLabelStyle(frame, "") numberr.frame.config(anchor=tk.W) numberr.frame.grid(row=i2 - 1, column=1, pady=2, sticky=tk.W + tk.E) name = btk.MyLabelStyle(frame, "") name.frame.grid(row=i2 - 1, column=2, padx=5, pady=2, sticky=tk.W + tk.E) name.frame.config(cursor="hand2") name.frame.bind("<Button-1>", lc_event1) kad = btk.MyLabelStyle(frame, "") kad.frame.grid(row=i2 - 1, column=3, padx=5, pady=2, sticky=tk.W + tk.E) mapp = btk.MyLabelStyle(frame, "") mapp.frame.grid(row=i2 - 1, column=4, padx=5, pady=2, sticky=tk.W + tk.E) date = btk.MyLabelStyle(frame, "") date.frame.grid(row=i2 - 1, column=5, padx=5, pady=2, sticky=tk.W + tk.E) comm = btk.MyEntryStyle(frame, "") comm.frame.config(state=tk.NORMAL, bg="#101010", fg="white", insertbackground="white") comm.frame.grid(row=i2 - 1, column=6, padx=5, pady=2, sticky=tk.W + tk.E) self.watchlist.append({ "btn": check, "nr": numberr, "name": name, "kad": kad, "map": mapp, "date": date, "comm": comm, "player": None }) # self.sf.inner.grid_columnconfigure(0, minsize=0.05 * sizex, weight=1) # self.sf.inner.grid_columnconfigure(1, minsize=0.05 * sizex, weight=1) frame.grid_columnconfigure(2, minsize=0.27 * sizex, weight=1) frame.grid_columnconfigure(3, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(4, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(5, minsize=0.15 * sizex, weight=1) frame.grid_columnconfigure(6, minsize=0.2 * sizex, weight=1) # self.sf.inner.grid_propagate(False) # self.frame.update_idletasks() frame.pack(fill=tk.BOTH) # frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) # label = btk.MyLabelStyle(frame, "_" * 300) # label.frame.pack() # frame.pack_propagate(False) # frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=15) btn = btk.MyButtonStyle(frame, "1 <<", lambda: self._update_page(1)) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) btn = btk.MyButtonStyle( frame, "<", lambda: self._update_page( self._check_int(self.entry_page.text.get(), -1))) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) self.entry_page = btk.MyEntryStyle(frame, "0") self.entry_page.frame.config(width=5, state=tk.NORMAL) self.entry_page.frame.pack(side=tk.LEFT, padx=5) self.entry_page.frame.bind("<Return>", self._enter_event) btn = btk.MyButtonStyle( frame, ">", lambda: self._update_page( self._check_int(self.entry_page.text.get(), 1))) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) self.btn_lastpage = btk.MyButtonStyle( frame, ">>", lambda: self._update_page(self._maxpages)) self.btn_lastpage.btn.config(width=5) self.btn_lastpage.btn.pack(side=tk.LEFT, padx=5) frame.pack(pady=10) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=15) btn = btk.MyButtonStyle(frame, "(De) Select All", self._elect_btns) btn.btn.grid(row=0, column=0, padx=5) btn = btk.MyButtonStyle(frame, "Remove selected", self._remove_pl) btn.btn.grid(row=0, column=1, padx=5) btn = btk.MyButtonStyle(frame, "(Un) Mark Banned", self._mark_ban) btn.btn.grid(row=0, column=2, padx=5) btn = btk.MyButtonStyle(frame, "Check VAC", lambda: f.check_vac(self)) btn.btn.grid(row=0, column=3, padx=5) frame.pack(side=tk.LEFT) self._check_stats() frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) self.stats_players = btk.MyLabelStyle( frame, "Total players: " + str(self._stats["nrpl"])) self.stats_players.frame.config(font=("", 12, "bold")) self.stats_players.frame.grid(row=0, column=0, sticky=tk.W) self.stats_banned = btk.MyLabelStyle( frame, "Banned players: " + str(self._stats["ban"])) self.stats_banned.frame.config(font=("", 12, "bold")) self.stats_banned.frame.grid(row=1, column=0, sticky=tk.W) if self._stats["nrpl"] == 0: percent = "--.--" else: percent = round(self._stats["ban"] / self._stats["nrpl"] * 100, 2) self.percent = btk.MyLabelStyle(frame, "Percent: " + str(percent) + " %") self.percent.frame.config(font=("", 12, "bold")) self.percent.frame.grid(row=2, column=0, sticky=tk.W) self.btn_lastpage.text.set(">> " + str(self._maxpages)) frame.pack(side=tk.RIGHT) self._update_page(self._maxpages) self.window.pack_propagate(False) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, title, sizex, sizey): self.window = tk.Tk() self.window.title(title) self.window.minsize(sizex, sizey) # self.window.maxsize(sizex, sizey) # self.window.resizable(False, False) self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.btn1_interfaces = btk.MyOptMenuStyle(self.window, "Select one interface", f.get_interfaces()) self.btn1_interfaces.btn.grid(row=0, column=0, sticky=tk.W + tk.E, columnspan=7, pady=5, padx=5) self.btn2_start = btk.MyButtonStyle(self.window, "Start", self.start_stop) self.btn2_start.btn.config(font=("", 16, "")) self.btn2_start.btn.grid(row=0, column=7, columnspan=2, rowspan=2, sticky=tk.NSEW, padx=5, pady=5) self.label1_dynamic = btk.MyLabelStyle(self.window, "Not looking for anything") self.label1_dynamic.frame.config(borderwidth=10, font=("", 14, "bold"), fg="red") self.label1_dynamic.frame.grid(row=1, column=0, columnspan=7) self.entry1_url = btk.MyEntryStyle(self.window, "") self.entry1_url.frame.grid(row=2, column=0, sticky=tk.W + tk.E, columnspan=9, ipady=3, padx=5, pady=2) self.menu1_entry1_copy = btk.MyMenuStyle(self.window) self.menu1_entry1_copy.menu.add_command( label="Copy", command=lambda: f.copy_to_clipboard( self.entry1_url.frame, "http://" + self.entry1_url.text.get())) def rc_event1(event): self.menu1_entry1_copy.menu.post(event.x_root, event.y_root) self.entry1_url.frame.bind("<Button-3>", rc_event1) self.label2_count = btk.MyLabelStyle(self.window, "Total DEMOs: 0") self.label2_count.frame.grid(row=3, column=0, columnspan=3, sticky=tk.W, padx=5) self.label3_time = btk.MyLabelStyle(self.window, "No LINK found") self.label3_time.frame.grid(row=3, column=2, columnspan=4, sticky=tk.W + tk.E, padx=5) self.btn3_download = btk.MyButtonStyle( self.window, "Download DEMO", lambda: f.open_link( self.entry1_url.text.get(), self.btn3_download)) self.btn3_download.btn.grid(row=3, column=7, columnspan=2, sticky=tk.W + tk.E, padx=5, pady=1) self.btn4_link_list = btk.MyButtonStyle( self.window, "LINK List", lambda: LW.LinkListWindow(self.window)) self.btn4_link_list.btn.grid(row=9, column=7, sticky=tk.W + tk.E, padx=5, pady=1) self.btn5_settings = btk.MyButtonStyle( self.window, "Settings", lambda: SW.SettingsWindow(self.window)) self.btn5_settings.btn.grid(row=9, column=8, sticky=tk.W + tk.E, padx=5, pady=1) self.btn6_round = btk.MyOptMenuStyle(self.window, "Select a round", []) self.btn6_round.btn.grid(row=4, column=7, sticky=tk.W + tk.E, columnspan=2, pady=5, padx=5) self.btn7_add_wl = btk.MyButtonStyle(self.window, "Add to Watchlist", self._addto_watchlist) self.btn7_add_wl.btn.grid(row=6, column=7, columnspan=2, sticky=tk.W + tk.E, padx=5) self.btn8_watchlist = btk.MyButtonStyle(self.window, "WatchList", self._open_watchlist) self.btn8_watchlist.btn.grid(row=7, column=7, columnspan=2, sticky=tk.W + tk.E, padx=5) self.label_teamct = btk.MyLabelStyle(self.window, "CT") self.label_teamct.frame.config(font=("", 16, "bold"), fg="#00bfff") self.label_teamct.frame.grid(row=4, column=0, columnspan=2, sticky=tk.NSEW, padx=5) self.label_scorect = btk.MyLabelStyle(self.window, "0") self.label_scorect.frame.config(font=("", 16, "")) self.label_scorect.frame.grid(row=4, column=2, sticky=tk.NSEW, padx=5) # self.label_map = btk.MyLabelStyle(self.window, "-") # self.label_map.frame.grid(row=4, column=3, sticky=tk.W + tk.E, padx=5) self.label_scoresep = btk.MyLabelStyle(self.window, "-") self.label_scoresep.frame.config(font=("", 14, "")) self.label_scoresep.frame.grid(row=4, column=3) self.label_scoret = btk.MyLabelStyle(self.window, "0") self.label_scoret.frame.config(font=("", 16, "")) self.label_scoret.frame.grid(row=4, column=4, sticky=tk.NSEW, padx=5) self.label_teamt = btk.MyLabelStyle(self.window, "T") self.label_teamt.frame.config(font=("", 16, "bold"), fg="#df2020") self.label_teamt.frame.grid(row=4, column=5, columnspan=2, sticky=tk.NSEW, padx=5) self.label_player1 = btk.MyLabelStyle(self.window, "???") self.label_player1.frame.grid(row=5, column=1, sticky=tk.W + tk.E, padx=5) self.label_player2 = btk.MyLabelStyle(self.window, "???") self.label_player2.frame.grid(row=6, column=1, sticky=tk.W + tk.E, padx=5) self.label_player3 = btk.MyLabelStyle(self.window, "???") self.label_player3.frame.grid(row=7, column=1, sticky=tk.W + tk.E, padx=5) self.label_player4 = btk.MyLabelStyle(self.window, "???") self.label_player4.frame.grid(row=8, column=1, sticky=tk.W + tk.E, padx=5) self.label_player5 = btk.MyLabelStyle(self.window, "???") self.label_player5.frame.grid(row=9, column=1, sticky=tk.W + tk.E, padx=5) self.label_player6 = btk.MyLabelStyle(self.window, "???") self.label_player6.frame.grid(row=5, column=5, sticky=tk.W + tk.E, padx=5) self.label_player7 = btk.MyLabelStyle(self.window, "???") self.label_player7.frame.grid(row=6, column=5, sticky=tk.W + tk.E, padx=5) self.label_player8 = btk.MyLabelStyle(self.window, "???") self.label_player8.frame.grid(row=7, column=5, sticky=tk.W + tk.E, padx=5) self.label_player9 = btk.MyLabelStyle(self.window, "???") self.label_player9.frame.grid(row=8, column=5, sticky=tk.W + tk.E, padx=5) self.label_player10 = btk.MyLabelStyle(self.window, "???") self.label_player10.frame.grid(row=9, column=5, sticky=tk.W + tk.E, padx=5) def lc_event1(event): link = g.profile_links[event.widget] if len(link) == 0: return if g.browser_path is None: web.open_new_tab(link) else: sp.Popen(g.browser_path + " " + link) self.btn_rad1 = btk.MyCheckButtonStyle(self.window) self.btn_rad1.btn.grid(row=5, column=0, padx=5) self.btn_rad2 = btk.MyCheckButtonStyle(self.window) self.btn_rad2.btn.grid(row=6, column=0, padx=5) self.btn_rad3 = btk.MyCheckButtonStyle(self.window) self.btn_rad3.btn.grid(row=7, column=0, padx=5) self.btn_rad4 = btk.MyCheckButtonStyle(self.window) self.btn_rad4.btn.grid(row=8, column=0, padx=5) self.btn_rad5 = btk.MyCheckButtonStyle(self.window) self.btn_rad5.btn.grid(row=9, column=0, padx=5) self.btn_rad6 = btk.MyCheckButtonStyle(self.window) self.btn_rad6.btn.grid(row=5, column=6, padx=5) self.btn_rad7 = btk.MyCheckButtonStyle(self.window) self.btn_rad7.btn.grid(row=6, column=6, padx=5) self.btn_rad8 = btk.MyCheckButtonStyle(self.window) self.btn_rad8.btn.grid(row=7, column=6, padx=5) self.btn_rad9 = btk.MyCheckButtonStyle(self.window) self.btn_rad9.btn.grid(row=8, column=6, padx=5) self.btn_rad10 = btk.MyCheckButtonStyle(self.window) self.btn_rad10.btn.grid(row=9, column=6, padx=5) self._reset_chekcs() self.label_scorep1 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep1.frame.grid(row=5, column=2, sticky=tk.W, padx=5) self.label_scorep2 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep2.frame.grid(row=6, column=2, sticky=tk.W, padx=5) self.label_scorep3 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep3.frame.grid(row=7, column=2, sticky=tk.W, padx=5) self.label_scorep4 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep4.frame.grid(row=8, column=2, sticky=tk.W, padx=5) self.label_scorep5 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep5.frame.grid(row=9, column=2, sticky=tk.W, padx=5) self.label_scorep6 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep6.frame.grid(row=5, column=4, sticky=tk.E, padx=5) self.label_scorep7 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep7.frame.grid(row=6, column=4, sticky=tk.E, padx=5) self.label_scorep8 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep8.frame.grid(row=7, column=4, sticky=tk.E, padx=5) self.label_scorep9 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep9.frame.grid(row=8, column=4, sticky=tk.E, padx=5) self.label_scorep10 = btk.MyLabelStyle(self.window, "0 / 0 / 0") self.label_scorep10.frame.grid(row=9, column=4, sticky=tk.E, padx=5) # self.label_sep1 = btk.MyLabelStyle(self.window, "|") # self.label_sep1.frame.grid(row=5, column=3, sticky=tk.W + tk.E, padx=5) # self.label_sep2 = btk.MyLabelStyle(self.window, "|") # self.label_sep2.frame.grid(row=6, column=3, sticky=tk.W + tk.E, padx=5) # self.label_sep3 = btk.MyLabelStyle(self.window, "|") # self.label_sep3.frame.grid(row=7, column=3, sticky=tk.W + tk.E, padx=5) # self.label_sep4 = btk.MyLabelStyle(self.window, "|") # self.label_sep4.frame.grid(row=8, column=3, sticky=tk.W + tk.E, padx=5) # self.label_sep5 = btk.MyLabelStyle(self.window, "|") # self.label_sep5.frame.grid(row=9, column=3, sticky=tk.W + tk.E, padx=5) for i2 in range(1, 11): g.profile_links.update( {getattr(self, "label_player" + str(i2)).frame: ""}) if i2 < 6: getattr(self, "label_player" + str(i2)).frame.config(cursor="hand2", anchor=tk.W) else: getattr(self, "label_player" + str(i2)).frame.config(cursor="hand2", anchor=tk.E) getattr(self, "label_player" + str(i2)).frame.bind( "<Button-1>", lc_event1) getattr(self, "label_scorep" + str(i2)).frame.config(font=("", 12, "")) self.window.grid_columnconfigure(0, minsize=0.05 * sizex, weight=1) self.window.grid_columnconfigure(1, minsize=0.2 * sizex, weight=1) self.window.grid_columnconfigure(2, minsize=0.12 * sizex, weight=1) self.window.grid_columnconfigure(3, minsize=0.02 * sizex, weight=1) self.window.grid_columnconfigure(4, minsize=0.12 * sizex, weight=1) self.window.grid_columnconfigure(5, minsize=0.2 * sizex, weight=1) self.window.grid_columnconfigure(6, minsize=0.05 * sizex, weight=1) # 0.7 self.window.grid_columnconfigure(7, minsize=0.12 * sizex, weight=1) self.window.grid_columnconfigure(8, minsize=0.12 * sizex, weight=1) self.window.grid_propagate(False) # self.window.grid_rowconfigure(0, minsize=0.06 * sizey, weight=1) # self.window.grid_rowconfigure(1, minsize=0.14 * sizey, weight=1) # self.window.grid_rowconfigure(2, minsize=0.1 * sizey, weight=1) # self.window.grid_rowconfigure(3, minsize=0.05 * sizey, weight=1) # self.window.grid_rowconfigure(4, minsize=0.1 * sizey, weight=1) self.window.grid_rowconfigure(5, minsize=30, weight=0) self.window.grid_rowconfigure(6, minsize=30, weight=0) self.window.grid_rowconfigure(7, minsize=30, weight=0) self.window.grid_rowconfigure(8, minsize=30, weight=0) self.window.grid_rowconfigure(9, minsize=30, weight=0) self.window.update_idletasks()
def __init__(self, root): try: self.rfile = open(g.path_exec_folder + "watchlist", "r", encoding="utf-8") self.csvfile = mycsv.myCSV(self.rfile) except FileNotFoundError: tempwrite = open(g.path_exec_folder + "watchlist", "w", encoding="utf-8", newline="") csvtemp = csv.writer(tempwrite) csvtemp.writerow(g.csv_header) tempwrite.close() self.rfile = open(g.path_exec_folder + "watchlist", "r", encoding="utf-8") self.csvfile = mycsv.myCSV(self.rfile) self.findex = 1 self._lastpage = 0 self._maxpages = 0 self._stats = dict() self.watchlist = list() self.to_remove = set() self.to_ban = set() self.to_comm = set() self.comm_dict = dict() self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("WatchList") self.window.minsize(805, 465) # self.window.resizable(False, False) sizex = self.window.minsize()[0] self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.close_and_update) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, " \\") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=0, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, " ##") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=1, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "NAME") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=2, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "RANK") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=3, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "KAD") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=4, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "MAP") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=5, padx=5, sticky=tk.W + tk.E) self.label_bandate = btk.MyLabelStyle(frame, "DEMO DATE") self.label_bandate.frame.config( font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) self.label_bandate.frame.grid(row=0, column=6, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "COMMENTS") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=7, padx=5, sticky=tk.W + tk.E) # frame.grid_columnconfigure(0, minsize=0.002 * sizex, weight=1) # frame.grid_columnconfigure(1, minsize=0.002 * sizex, weight=1) frame.grid_columnconfigure(2, minsize=0.23 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(3, minsize=0.08 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(4, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(5, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(6, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(7, minsize=0.2 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_propagate(False) frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, "_" * 300) label.frame.pack() frame.pack_propagate(False) frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=300) def lc_event1(event): for item in self.watchlist: if item["name"].frame == event.widget: link = item["player"].link if item[ "player"] is not None else None break if link is None or len(link) == 0: return if g.browser_path is None: web.open_new_tab(link) else: sp.Popen(g.browser_path + " " + link) for i2 in range(1, 11): check = btk.MyCheckButtonStyle(frame) check.btn.grid(row=i2 - 1, column=0) numberr = btk.MyLabelStyle(frame, "") numberr.frame.config(anchor=tk.W) numberr.frame.grid(row=i2 - 1, column=1, pady=2, sticky=tk.W + tk.E) name = btk.MyLabelStyle(frame, "") name.frame.grid(row=i2 - 1, column=2, padx=5, pady=2, sticky=tk.W + tk.E) name.frame.config(cursor="hand2") name.frame.bind("<Button-1>", lc_event1) rank = btk.MyLabelStyle(frame, "") rank.frame.grid(row=i2 - 1, column=3, padx=5, pady=2, sticky=tk.W + tk.E) kad = btk.MyLabelStyle(frame, "") kad.frame.grid(row=i2 - 1, column=4, padx=5, pady=2, sticky=tk.W + tk.E) mapp = btk.MyLabelStyle(frame, "") mapp.frame.grid(row=i2 - 1, column=5, padx=5, pady=2, sticky=tk.W + tk.E) date = btk.MyLabelStyle(frame, "") date.frame.grid(row=i2 - 1, column=6, padx=5, pady=2, sticky=tk.W + tk.E) comm = btk.MyEntryStyle(frame, "") comm.frame.config(state=tk.NORMAL, bg="#101010", fg="white", insertbackground="white") comm.frame.grid(row=i2 - 1, column=7, padx=5, pady=2, sticky=tk.W + tk.E) self.watchlist.append({ "btn": check, "nr": numberr, "name": name, "rank": rank, "kad": kad, "map": mapp, "date": date, "comm": comm, "player": None }) # self.sf.inner.grid_columnconfigure(0, minsize=0.05 * sizex, weight=1) # self.sf.inner.grid_columnconfigure(1, minsize=0.05 * sizex, weight=1) frame.grid_columnconfigure(2, minsize=0.22 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(3, minsize=0.08 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(4, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(5, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(6, minsize=0.14 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(7, minsize=0.2 * sizex * g.settings_dict["scaling"], weight=1) weightt = 0 if g.settings_dict["scaling"] == 1 else 1 frame.grid_rowconfigure(0, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(1, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(2, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(3, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(4, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(5, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(6, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(7, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(8, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(9, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_rowconfigure(10, minsize=15 * g.settings_dict["scaling"], weight=weightt) frame.grid_propagate(False) # self.frame.update_idletasks() frame.pack(fill=tk.BOTH) # frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) # label = btk.MyLabelStyle(frame, "_" * 300) # label.frame.pack() # frame.pack_propagate(False) # frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=15) btn = btk.MyButtonStyle(frame, "1 <<", lambda: self._update_page(1)) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) btn = btk.MyButtonStyle( frame, "<", lambda: self._update_page( self._check_int(self.entry_page.text.get(), -1))) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) self.entry_page = btk.MyEntryStyle(frame, "0") self.entry_page.frame.config(width=5, state=tk.NORMAL) self.entry_page.frame.pack(side=tk.LEFT, padx=5) self.entry_page.frame.bind("<Return>", self._enter_event) btn = btk.MyButtonStyle( frame, ">", lambda: self._update_page( self._check_int(self.entry_page.text.get(), 1))) btn.btn.config(width=5) btn.btn.pack(side=tk.LEFT, padx=5) self.btn_lastpage = btk.MyButtonStyle( frame, ">>", lambda: self._update_page(self._maxpages)) self.btn_lastpage.btn.config(width=5) self.btn_lastpage.btn.pack(side=tk.LEFT, padx=5) frame.pack(pady=10) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=15) btn = btk.MyButtonStyle(frame, "(De) Select All", self._elect_btns) btn.btn.grid(row=0, column=0, padx=5) btn = btk.MyButtonStyle(frame, "Remove selected", self._remove_pl) btn.btn.grid(row=0, column=1, padx=5) btn = btk.MyButtonStyle(frame, "(Un) Mark Banned", self._mark_ban) btn.btn.grid(row=0, column=2, padx=5) btn = btk.MyButtonStyle(frame, "Check VAC", lambda: CVW.MyVacWindow(self)) btn.btn.grid(row=0, column=3, padx=5) self.btn_switch_speed = btk.MyButtonStyle(frame, "Ban Speed", self._switch_ban_speed) self.btn_switch_speed.btn.grid(row=0, column=4, padx=5) # btn = btk.MyButtonStyle(frame, "Extra", lambda: WEW.MyWlextraWindow(self)) btn = btk.MyButtonStyle(frame, "More Stats", self._open_more_stats) btn.btn.grid(row=0, column=5, padx=5) frame.pack(side=tk.LEFT) self._check_stats() frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) self.stats_players = btk.MyLabelStyle( frame, "Total players: " + str(self._stats["nrpl"])) self.stats_players.frame.config( font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) self.stats_players.frame.grid(row=0, column=0, sticky=tk.W) self.stats_banned = btk.MyLabelStyle( frame, "Banned players: " + str(self._stats["ban"])) self.stats_banned.frame.config( font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) self.stats_banned.frame.grid(row=1, column=0, sticky=tk.W) if self._stats["nrpl"] == 0: percent = "--.--" else: percent = round(self._stats["ban"] / self._stats["nrpl"] * 100, 2) self.percent = btk.MyLabelStyle(frame, "Percent: " + str(percent) + " %") self.percent.frame.config( font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) self.percent.frame.grid(row=2, column=0, sticky=tk.W) self.btn_lastpage.text.set(">> " + str(self._maxpages)) frame.pack(side=tk.RIGHT) self.window.update_idletasks() # takes half a second every time you open the wl and the app is white during that so i'll just use the main ones # label_size = (self.watchlist[0]["rank"].frame.winfo_width(), self.watchlist[0]["rank"].frame.winfo_height()) # g.RANK_TRANSLATE_WL = { # 0: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\0.png").resize(label_size, pili.ANTIALIAS)), # 1: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\1.png").resize(label_size, pili.ANTIALIAS)), # 2: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\2.png").resize(label_size, pili.ANTIALIAS)), # 3: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\3.png").resize(label_size, pili.ANTIALIAS)), # 4: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\4.png").resize(label_size, pili.ANTIALIAS)), # 5: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\5.png").resize(label_size, pili.ANTIALIAS)), # 6: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\6.png").resize(label_size, pili.ANTIALIAS)), # 7: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\7.png").resize(label_size, pili.ANTIALIAS)), # 8: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\8.png").resize(label_size, pili.ANTIALIAS)), # 9: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\9.png").resize(label_size, pili.ANTIALIAS)), # 10: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\10.png").resize(label_size, pili.ANTIALIAS)), # 11: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\11.png").resize(label_size, pili.ANTIALIAS)), # 12: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\12.png").resize(label_size, pili.ANTIALIAS)), # 13: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\13.png").resize(label_size, pili.ANTIALIAS)), # 14: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\14.png").resize(label_size, pili.ANTIALIAS)), # 15: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\15.png").resize(label_size, pili.ANTIALIAS)), # 16: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\16.png").resize(label_size, pili.ANTIALIAS)), # 17: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\17.png").resize(label_size, pili.ANTIALIAS)), # 18: piltk.PhotoImage( # pili.open(fr"{g.exec_path}resources\csgo_rank_icons\18.png").resize(label_size, pili.ANTIALIAS)), # } self._update_page(self._maxpages) self.window.pack_propagate(False) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root): self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("Settings") self.window.minsize(580, 445) sizex = self.window.minsize()[0] sizey = self.window.minsize()[1] self.window.resizable(False, False) self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self._destroy_checkname) self.label_set8 = btk.MyLabelStyle(self.window, "Auto start scanning when opening the app") self.label_set8.frame.grid(row=0, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set8 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set8), "auto_start") self.btn_set8.btn.grid(row=0, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set1 = btk.MyLabelStyle(self.window, "Stop scanning after a DEMO LINK is found") self.label_set1.frame.grid(row=1, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set1 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set1), "stop_label") self.btn_set1.btn.grid(row=1, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set5 = btk.MyLabelStyle(self.window, "Auto download DEMO after a LINK is found") self.label_set5.frame.grid(row=2, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set5 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set5), "auto_dl") self.btn_set5.btn.grid(row=2, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set2 = btk.MyLabelStyle(self.window, "Use the browser to download (doesn't work with auto download)") self.label_set2.frame.grid(row=3, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set2 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set2), "browser_dl") self.btn_set2.btn.grid(row=3, column=0, sticky=tk.W + tk.E, padx=5, pady=5) def lc_event2(event): if g.browser_path is None: web.open_new_tab(g.SITE_OWREV) else: sp.Popen(g.browser_path + " " + g.SITE_OWREV) self.label_set7 = btk.MyLabelStyle(self.window, "Add suspects to database (zahar.one/owrev)") self.label_set7.frame.grid(row=4, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set7 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set7), "add_to_db") self.btn_set7.btn.grid(row=4, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.label_set7.frame.config(cursor="hand2") self.label_set7.frame.bind("<Button-1>", lc_event2) self.label_set3 = btk.MyLabelStyle(self.window, "*" * 50 + "Download location when not using the browser" + "*" * 50) self.label_set3.frame.config(width=45) self.label_set3.frame.grid(row=5, column=0, sticky=tk.W + tk.E, pady=5, columnspan=4) self.btn_browse = btk.MyButtonStyle(self.window, "Browse", self._set_download_path) self.btn_browse.btn.grid(row=6, column=0, sticky=tk.W + tk.E, padx=5) self.entry_browse = btk.MyEntryStyle(self.window, g.settings_dict["dl_loc"]) self.entry_browse.frame.grid(row=6, column=1, sticky=tk.W + tk.E, padx=5, columnspan=2) self.btn_opendl = btk.MyButtonStyle(self.window, "Open", lambda: os.system("start {}".format(g.settings_dict["dl_loc"]))) self.btn_opendl.btn.grid(row=6, column=3, sticky=tk.E, padx=5, pady=5) self.label_set3_1 = btk.MyLabelStyle(self.window, "*" * 200) self.label_set3_1.frame.config(width=45) self.label_set3_1.frame.grid(row=7, column=0, sticky=tk.W + tk.E, columnspan=4) self.label_set4 = btk.MyLabelStyle(self.window, "Rename downloaded demos to ") self.label_set4.frame.grid(row=8, column=1, sticky=tk.W, padx=5, pady=5) self.btn_set3 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set3), "rename_dl") self.btn_set3.btn.grid(row=8, column=0, sticky=tk.W + tk.E, padx=5, pady=5) self.entry_demo = btk.MyEntryStyle(self.window, g.settings_dict["rename"]) self.entry_demo.frame.config(state="normal") self.entry_demo.frame.grid(row=8, column=2, sticky=tk.W + tk.E, padx=5, columnspan=2) self.label_set6 = btk.MyLabelStyle(self.window, "Auto delete DEMO after it is analyzed") self.label_set6.frame.grid(row=9, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) self.btn_set6 = btk.MyButtonStyle(self.window, "ON", lambda: self._change_setting(self.btn_set6), "delete_after") self.btn_set6.btn.grid(row=9, column=0, sticky=tk.W + tk.E, padx=5, pady=5) # self.label_set7 = btk.MyLabelStyle(self.window, "Rank doodles") # self.label_set7.frame.grid(row=9, column=1, sticky=tk.W, padx=5, pady=5, columnspan=2) # self.btn_set7 = btk.MyButtonStyle(self.window, "OFF", lambda: self._change_setting(self.btn_set7), # "rank_doodles") # self.btn_set7.btn.grid(row=9, column=0, sticky=tk.W + tk.E, padx=5, pady=5) def lc_event3(event): if g.browser_path is None: web.open_new_tab("https://steamcommunity.com/dev/apikey") else: sp.Popen(g.browser_path + " " + "https://steamcommunity.com/dev/apikey") self.label_skey = btk.MyLabelStyle(self.window, "API Key:") self.label_skey.frame.config(cursor="hand2") self.label_skey.frame.grid(row=10, column=0, padx=5, pady=5) self.label_skey.frame.bind("<Button-1>", lc_event3) self.entry_steam_key = btk.MyEntryStyle(self.window, g.settings_dict["steam_api_key"]) self.entry_steam_key.frame.config(state="normal") self.entry_steam_key.frame.grid(row=10, column=1, sticky=tk.W + tk.E, padx=5, columnspan=3) self.btn_save = btk.MyButtonStyle(self.window, "Save settings", self._update_on_save) self.btn_save.btn.grid(row=11, column=3, sticky=tk.E, padx=5, pady=5) self.btn_analyze = btk.MyButtonStyle(self.window, "Analyze a demo", self._analyze_demo) self.btn_analyze.btn.grid(row=11, column=0, columnspan=2, sticky=tk.W, padx=5, pady=5) def lc_event1(event): if g.browser_path is None: web.open_new_tab(g.PROJECT_LINK) else: sp.Popen(g.browser_path + " " + g.PROJECT_LINK) self.label_github = btk.MyLabelStyle(self.window, "v{} {}".format(g.VERSION, g.PROJECT_LINK)) self.label_github.frame.config(cursor="hand2") self.label_github.frame.grid(row=11, column=1, padx=5, pady=5, columnspan=2) self.label_github.frame.bind("<Button-1>", lc_event1) self._update_all_settings() self.window.grid_columnconfigure(0, minsize=0.15 * sizex * g.settings_dict["scaling"], weight=1) self.window.grid_columnconfigure(1, minsize=0.5 * sizex * g.settings_dict["scaling"], weight=1) self.window.grid_columnconfigure(2, minsize=0.15 * sizex * g.settings_dict["scaling"], weight=1) self.window.grid_columnconfigure(3, minsize=0.2 * sizex * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(0, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(1, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(2, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(3, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(4, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(5, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(6, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(7, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(8, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(9, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(10, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_rowconfigure(11, minsize=0.083 * sizey * g.settings_dict["scaling"], weight=1) self.window.grid_propagate(False) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()
def __init__(self, root, nrplayers, nrbanned): self.window = tk.Toplevel(root) self.window.transient(root) self.window.title("WatchList Extra Stats") self.window.minsize(750, 350) sizex = self.window.minsize()[0] # sizey = self.window.minsize()[1] self.window.resizable(False, False) # self.window.attributes("-topmost") self.window.config(bg="#101010") self.window.protocol("WM_DELETE_WINDOW", self.window.destroy) self.window.bind("<MouseWheel>", self._scroll_func_mwheel) self.map_dict = dict() self.rank_dict = dict() self.server_dict = dict() self.mode_dict = dict() self.map_dict_b = dict() self.rank_dict_b = dict() self.server_dict_b = dict() self.mode_dict_b = dict() self.nrall = nrplayers self.nrbanned = nrbanned self._all_stats = True # self.labels_list = list() self._check_more_stats() frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, "RANKS") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=0, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "MAPS") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=1, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "SERVERS") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=2, padx=5, sticky=tk.W + tk.E) label = btk.MyLabelStyle(frame, "MODES") label.frame.config(font=("", math.ceil(12 * g.settings_dict["scaling"]), "bold")) label.frame.grid(row=0, column=3, padx=5, sticky=tk.W + tk.E) frame.grid_columnconfigure(0, minsize=0.1 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(1, minsize=0.15 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(2, minsize=0.25 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_columnconfigure(3, minsize=0.2 * sizex * g.settings_dict["scaling"], weight=1) frame.grid_propagate(False) frame.pack(fill=tk.X) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) label = btk.MyLabelStyle(frame, "_" * 300) label.frame.pack() frame.pack_propagate(False) frame.pack(fill=tk.X) self.stats_frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) self.scrollbar = tk.Scrollbar(self.stats_frame, orient=tk.VERTICAL, command=self._scroll_func) self.scrollbar.grid(row=0, column=4, padx=3, sticky=tk.N + tk.S) # self.scrollbar.config(bd=5, highlightthickness=0, bg="#101010", activebackground="#101010", troughcolor="#101010", # activerelief=tk.FLAT) self.rank_box = btk.MyListboxStyle(self.stats_frame, [], addmenu=False) self.rank_box.box.config(selectmode=tk.BROWSE, height=15, highlightthickness=0, relief=tk.FLAT, yscrollcommand=self.scrollbar.set) # self.rank_box.box.bind("<MouseWheel>", self._scroll_func_mwheel) self.map_box = btk.MyListboxStyle(self.stats_frame, [], addmenu=False) self.map_box.box.config(selectmode=tk.BROWSE, height=15, highlightthickness=0, relief=tk.FLAT, yscrollcommand=self.scrollbar.set) # self.map_box.box.bind("<MouseWheel>", self._scroll_func_mwheel) self.server_box = btk.MyListboxStyle(self.stats_frame, [], addmenu=False) self.server_box.box.config(selectmode=tk.BROWSE, height=15, highlightthickness=0, relief=tk.FLAT, yscrollcommand=self.scrollbar.set) # self.server_box.box.bind("<MouseWheel>", self._scroll_func_mwheel) self.mode_box = btk.MyListboxStyle(self.stats_frame, [], addmenu=False) self.mode_box.box.config(selectmode=tk.BROWSE, height=15, highlightthickness=0, relief=tk.FLAT, yscrollcommand=self.scrollbar.set) # self.mode_box.box.bind("<MouseWheel>", self._scroll_func_mwheel) self.rank_box.box.grid(row=0, column=0, sticky=tk.NSEW) self.map_box.box.grid(row=0, column=1, sticky=tk.NSEW) self.server_box.box.grid(row=0, column=2, sticky=tk.NSEW) self.mode_box.box.grid(row=0, column=3, sticky=tk.NSEW) self._show_stats(nrplayers) self.stats_frame.grid_columnconfigure(0, minsize=0.16 * sizex * g.settings_dict["scaling"], weight=1) self.stats_frame.grid_columnconfigure(1, minsize=0.31 * sizex * g.settings_dict["scaling"], weight=1) self.stats_frame.grid_columnconfigure(2, minsize=0.24 * sizex * g.settings_dict["scaling"], weight=1) self.stats_frame.grid_columnconfigure(3, minsize=0.22 * sizex * g.settings_dict["scaling"], weight=1) # self.stats_frame.grid_columnconfigure(4, minsize=0.06 * sizex, weight=1) # frame.grid_propagate(False) self.stats_frame.pack(fill=tk.BOTH) frame = tk.Frame(self.window, bg="#101010", width=sizex, height=20) self.btn1 = btk.MyButtonStyle(frame, "Show only banned players", self._switch_stats) self.btn1.btn.pack(padx=5, pady=5) frame.pack(pady=10, fill=tk.X) # self.window.pack_propagate(False) self.window.update_idletasks() self.window.geometry("+%d+%d" % (f.calc_window_pos(root, self.window))) self.window.grab_set() self.window.focus_set()