MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / __init__

Method __init__

Tests/Scripts/analyze-paced.py:58–116  ·  view source on GitHub ↗
(self, folder, name, run_mode, golds_folder=None)

Source from the content-addressed store, hash-verified

56
57class PolledPlotApp(tk.Tk):
58 def __init__(self, folder, name, run_mode, golds_folder=None):
59 super().__init__()
60 self.title("Polled CSV Plotter")
61 self.geometry("900x650")
62
63 # Persist per-series visibility across Y selections
64 self.visible = {} # {series_label: bool}
65 # Persist per-series style for legend proxies
66 self.styles = {} # {series_label: dict(color=..., linestyle=..., marker=...)}
67
68 # Load CSVs according to run mode
69 self.dfs = self.load_csvs(folder, name, golds_folder, run_mode)
70 if not self.dfs:
71 messagebox.showerror("Error", "No valid CSV files found for the given inputs.")
72 self.destroy()
73 return
74
75 # Initialize columns/UI
76 cols = list(self.dfs[0][1].columns)
77 if len(cols) < 2:
78 messagebox.showerror("Error", "CSV files must have at least two columns.")
79 self.destroy()
80 return
81
82 self.x_col = cols[0]
83 self.y_choices = cols[1:]
84
85 ctrl = ttk.Frame(self)
86 ctrl.pack(side=tk.TOP, fill=tk.X, padx=8, pady=8)
87
88 ttk.Label(ctrl, text="X-axis:").pack(side=tk.LEFT)
89 ttk.Label(ctrl, text=self.x_col, width=15).pack(side=tk.LEFT, padx=(0, 20))
90 ttk.Label(ctrl, text="Y-axis:").pack(side=tk.LEFT)
91
92 self.y_combo = AutocompleteCombobox(ctrl, state="normal", width=50)
93 self.y_combo.set_completion_list(self.y_choices)
94 self.y_combo.set(self.y_choices[0])
95 self.y_combo.pack(side=tk.LEFT, padx=(0, 10))
96 self.y_combo.bind("<<ComboboxSelected>>", self.on_select)
97
98 ttk.Button(ctrl, text="Exit", command=self.destroy).pack(side=tk.RIGHT)
99
100 # Matplotlib figure/canvas/toolbar
101 self.fig = Figure(figsize=(6, 4))
102 self.ax = self.fig.add_subplot(111)
103
104 self.canvas = FigureCanvasTkAgg(self.fig, master=self)
105 self.canvas.draw()
106 self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
107
108 self.toolbar = NavigationToolbar2Tk(self.canvas, self)
109 self.toolbar.update()
110 self.toolbar.pack(side=tk.TOP, fill=tk.X)
111
112 # One pick handler for the lifetime of the app
113 self.fig.canvas.mpl_connect("pick_event", self.on_pick)
114
115 # Initial draw

Callers 1

__init__Method · 0.45

Calls 4

load_csvsMethod · 0.95
draw_plotMethod · 0.95
set_completion_listMethod · 0.80

Tested by

no test coverage detected