Commit c49fb795 authored by Hafiz Emin Kosar's avatar Hafiz Emin Kosar
Browse files

- shift+click now used for deletion of poles/zeros

parent 8b3f80ac
......@@ -37,7 +37,8 @@ class pzPlot():
mode = 'p'
mode_types = {'Polstelle': 'p', 'Nullstelle': 'z'}
action = 'add'
action_types = {'Hinzufügen / Löschen': 'add', 'Konvergenzbereich ändern': 'roc'}
action_locked = False
action_types = {'Hinzufügen': 'add', 'Löschen': 'del', 'Konvergenzbereich ändern': 'roc'}
H = None
Hlog = None
......@@ -101,17 +102,25 @@ class pzPlot():
self.ax.set_title('Pol- /Nullstellen Diagramm', fontsize='12')
def onclick(event):
if not self.action == 'roc':
if event.button == 1: # Left click
self.action = 'add'
elif event.button == 2 or event.button == 3: # Middle or right click
self.action = 'del'
if self.action == 'add' and event.key == 'shift':
self.action = 'del'
if event.inaxes != self.ax: return
if self.filter != 'man': return
p = event.xdata + 1j * event.ydata
self.update_point(p, self.mode)
def onkeypress(event):
self.action_locked = True if self.action == 'del' else False
self.w_action_type.children[0].value = 'Löschen'
def onkeyrelease(event):
if not self.action_locked:
self.w_action_type.children[0].value = 'Hinzufügen'
self.fig.canvas.mpl_connect('button_press_event', onclick)
self.fig.canvas.mpl_connect('key_press_event', onkeypress)
self.fig.canvas.mpl_connect('key_release_event', onkeyrelease)
self.handles['axh'] = plt.subplot(gs[0, 1])
self.handles['axh'].set_title('Impulsantwort', fontsize='12')
......@@ -139,7 +148,7 @@ class pzPlot():
# Widgets
self.w_filter_type = interactive(self.update_filter,filtr=widgets.Dropdown(options=list(self.filter_types.keys()), value="Sprungfunktion", description='Filter'))
self.w_action_type = interactive(self.update_action,action=widgets.Dropdown(options=list(self.action_types.keys()),value="Hinzufügen / Löschen", description='Modus', disabled=True))
self.w_action_type = interactive(self.update_action,action=widgets.Dropdown(options=list(self.action_types.keys()),value="Hinzufügen", description='Modus', disabled=True))
self.w_point_type = interactive(self.update_mode,mode=widgets.Dropdown(options=list(self.mode_types.keys()), value="Polstelle", description='Typ', disabled=True))
self.w_amp_type = interactive(self.update_amp, H0=widgets.IntSlider(min=1,max=10,step=1,value=1), description="H0")
self.w_no_of_poles = interactive(self.update_no_of_poles, P=widgets.IntSlider(min=1,max=7,step=1,value=1), description="P")
......
Supports Markdown
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