Commit 7ca31c3d authored by Claes Sjofors's avatar Claes Sjofors Committed by Claes Sjöfors

Event anlyser, more work

parent c065bcd9
sev/exp/py/src/evatoolbar_filter.png

544 Bytes | W: | H:

sev/exp/py/src/evatoolbar_filter.png

656 Bytes | W: | H:

sev/exp/py/src/evatoolbar_filter.png
sev/exp/py/src/evatoolbar_filter.png
sev/exp/py/src/evatoolbar_filter.png
sev/exp/py/src/evatoolbar_filter.png
  • 2-up
  • Swipe
  • Onion skin
sev/exp/py/src/evatoolbar_filtersup.png

469 Bytes | W: | H:

sev/exp/py/src/evatoolbar_filtersup.png

543 Bytes | W: | H:

sev/exp/py/src/evatoolbar_filtersup.png
sev/exp/py/src/evatoolbar_filtersup.png
sev/exp/py/src/evatoolbar_filtersup.png
sev/exp/py/src/evatoolbar_filtersup.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -66,6 +66,7 @@ matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import pickle
import co
import wow
from rt_mva import *
from rt_mva_msg import *
......@@ -1674,8 +1675,8 @@ class WdWindow:
viewmenu.add_command(label='Plot common', command=self.plot_action_cb)
viewmenu.add_command(label='Plot separate', command=self.indplot_action_cb)
viewmenu.add_command(label='Scatterplot', command=self.scatter_action_cb)
viewmenu.add_command(label='Plot correlation', command=self.corr_action_cb)
viewmenu.add_command(label='Plot correlation heatmap', command=self.corr2_action_cb)
viewmenu.add_command(label='Plot correlation', command=self.corr2_action_cb)
viewmenu.add_command(label='Plot correlation hinton', command=self.corr_action_cb)
viewmenu.add_command(label='Plot linear regression', command=self.regr_action_cb)
viewmenu.add_command(label='Plot histogram', command=self.histogram_action_cb)
viewmenu.add_command(label='Statistics', command=self.stat_action_cb)
......@@ -1702,46 +1703,52 @@ class WdWindow:
self.toolbar_plot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_plot.png")
button = Button(self.toolbar, image=self.toolbar_plot_img, command=self.plot_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Plot common')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_indplot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_indplot.png")
button = Button(self.toolbar, image=self.toolbar_indplot_img, command=self.indplot_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Plot separate')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_scatterplot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_scatterplot.png")
button = Button(self.toolbar, image=self.toolbar_scatterplot_img, command=self.scatter_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Scatterplot')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_lrplot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_lrplot.png")
button = Button(self.toolbar, image=self.toolbar_lrplot_img, command=self.regr_action_cb, bg=buttoncolor)
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_corrplot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_corrplot.png")
button = Button(self.toolbar, image=self.toolbar_corrplot_img, command=self.corr_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Linear regression plot')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_corr2plot_img = PhotoImage(file=pwr_exe+"/mvtoolbar_corr2plot.png")
button = Button(self.toolbar, image=self.toolbar_corr2plot_img, command=self.corr2_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Correlation plot')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_up_img = PhotoImage(file=pwr_exe+"/mvtoolbar_up.png")
button = Button(self.toolbar, image=self.toolbar_up_img, command=self.moveup_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Move item up')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_down_img = PhotoImage(file=pwr_exe+"/mvtoolbar_down.png")
button = Button(self.toolbar, image=self.toolbar_down_img, command=self.movedown_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Move item down')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_conv_img = PhotoImage(file=pwr_exe+"/mvtoolbar_conv.png")
button = Button(self.toolbar, image=self.toolbar_conv_img, command=self.convcolumn_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Convert item')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_add_img = PhotoImage(file=pwr_exe+"/mvtoolbar_add.png")
button = Button(self.toolbar, image=self.toolbar_add_img, command=self.addcolumn_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Add item')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar_delete_img = PhotoImage(file=pwr_exe+"/mvtoolbar_delete.png")
button = Button(self.toolbar, image=self.toolbar_delete_img, command=self.deletecolumn_action_cb, bg=buttoncolor)
wow.Tooltip(button, text='Delete item')
button.pack(side=LEFT, padx=2, pady=2)
self.toolbar.pack(side=TOP, fill=X)
......@@ -1865,7 +1872,11 @@ class FetchSev:
except IOError:
pass
try:
self.items = pwrrt.getSevItemList(self.server, filtervalue)
except RuntimeError as e:
tkMessageBox.showerror("Error", str(e))
return
self.itemframe = Frame(self.fswindow, bg=bgcolor)
......@@ -1988,8 +1999,13 @@ class FetchSev:
intervalvalue = float(self.intervalentry.get())
maxvalue = int(self.maxentry.get())
try:
result = pwrrt.getSevItemsDataFrame( self.server, dataoid, dataattr, isobject,
fromvalue, tovalue, intervalvalue, maxvalue)
except RuntimeError as e:
tkMessageBox.showerror("Error", str(e))
return
if result == None:
tkMessageBox.showerror("Error", "None return")
return
......
This diff is collapsed.
......@@ -311,7 +311,7 @@ class WData:
corrmat = plotdata.corr()
fig = plt.figure()
fig.canvas.set_window_title('Correlation Heatmap ' + self.name)
sns.heatmap(corrmat, vmin=-1., vmax=1., square=False, cmap='RdBu_r').xaxis.tick_top()
sns.heatmap(corrmat, vmin=-1., vmax=1., square=False, cmap='RdBu_r', annot=True).xaxis.tick_top()
plt.show()
def regression_plot(self, mask):
......
from Tkinter import *
import ttk
class Tooltip:
def __init__(self, widget,
bg='#FFFFEA',
pad=(5, 3, 5, 3),
text='widget info',
waittime=400,
wraplength=250):
self.waittime = waittime # in miliseconds, originally 500
self.wraplength = wraplength # in pixels, originally 180
self.widget = widget
self.text = text
self.widget.bind("<Enter>", self.onEnter)
self.widget.bind("<Leave>", self.onLeave)
self.widget.bind("<ButtonPress>", self.onLeave)
self.bg = bg
self.pad = pad
self.id = None
self.tw = None
def onEnter(self, event=None):
self.schedule()
def onLeave(self, event=None):
self.unschedule()
self.hide()
def schedule(self):
self.unschedule()
self.id = self.widget.after(self.waittime, self.show)
def unschedule(self):
id_ = self.id
self.id = None
if id_:
self.widget.after_cancel(id_)
def show(self):
def tip_pos_calculator(widget, label,
tip_delta=(10, 5), pad=(5, 3, 5, 3)):
w = widget
s_width, s_height = w.winfo_screenwidth(), w.winfo_screenheight()
width, height = (pad[0] + label.winfo_reqwidth() + pad[2],
pad[1] + label.winfo_reqheight() + pad[3])
mouse_x, mouse_y = w.winfo_pointerxy()
x1, y1 = mouse_x + tip_delta[0], mouse_y + tip_delta[1]
x2, y2 = x1 + width, y1 + height
x_delta = x2 - s_width
if x_delta < 0:
x_delta = 0
y_delta = y2 - s_height
if y_delta < 0:
y_delta = 0
offscreen = (x_delta, y_delta) != (0, 0)
if offscreen:
if x_delta:
x1 = mouse_x - tip_delta[0] - width
if y_delta:
y1 = mouse_y - tip_delta[1] - height
offscreen_again = y1 < 0 # out on the top
if offscreen_again:
# No further checks will be done.
# TIP:
# A further mod might automagically augment the
# wraplength when the tooltip is too high to be
# kept inside the screen.
y1 = 0
return x1, y1
bg = self.bg
pad = self.pad
widget = self.widget
# creates a toplevel window
self.tw = Toplevel(widget)
# Leaves only the label and removes the app window
self.tw.wm_overrideredirect(True)
win = Frame(self.tw,
background=bg,
borderwidth=0)
label = ttk.Label(win,
text=self.text,
justify=LEFT,
background=bg,
relief=SOLID,
borderwidth=0,
wraplength=self.wraplength)
label.grid(padx=(pad[0], pad[2]),
pady=(pad[1], pad[3]),
sticky=NSEW)
win.grid()
x, y = tip_pos_calculator(widget, label)
self.tw.wm_geometry("+%d+%d" % (x, y))
def hide(self):
tw = self.tw
if tw:
tw.destroy()
self.tw = None
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment