-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.py
66 lines (57 loc) · 2.11 KB
/
Settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import wx
from matplotlib import pyplot as plt
import seaborn as sns
from Dialogues import GraphSettings
settings = {}
class SettingsMenu(wx.Menu):
funcs, settings = None, None
def __init__(self, parent):
wx.Menu.__init__(self)
self.funcs = {}
self.parent = parent
parent.Bind(wx.EVT_MENU, self.toggleShell,
self.Append(wx.NewId(), 'Toggle Shell'))
parent.Bind(wx.EVT_MENU, self.toggleScript,
self.Append(wx.NewId(), 'Toggle Scripter'))
self.AppendSeparator()
parent.Bind(wx.EVT_MENU, self.graphSettings,
self.Append(wx.NewId(), 'Graph Settings'))
""" Default Settings """
settings["style"] = "whitegrid"
self.funcs["style"] = sns.set_style
settings["color"] = "bright"
self.funcs["color"] = sns.set_palette
settings["cmap"] = "coolwarm"
settings["Title Size"] = 36
self.funcs["Title Size"] = self.changeTitle
settings["Legend Size"] = 22
self.funcs["Legend Size"] = self.changeLegend
settings["Axis Size"] = 28
self.funcs["Axis Size"] = self.changeAxis
settings["Tick Size"] = 16
self.funcs["Tick Size"] = self.changeTick
for k, f in self.funcs.iteritems():
f(settings[k])
def changeTitle(self, x):
plt.rcParams["axes.titlesize"] = x
def changeLegend(self, x):
plt.rcParams["legend.fontsize"] = x
def changeAxis(self, x):
plt.rcParams["axes.labelsize"] = x
def changeTick(self, x):
plt.rcParams["xtick.labelsize"] = x
plt.rcParams["ytick.labelsize"] = x
def toggleShell(self, event):
pass
def toggleScript(self, event):
pass
def graphSettings(self, event):
dlg = GraphSettings(self.parent, settings)
if dlg.ShowModal() == wx.ID_OK:
d = dlg.GetValue()
for key in d:
if d[key] != settings[key]:
settings[key] = d[key]
if key in self.funcs:
self.funcs[key](d[key])
print key