KeyBindings not working, but not on every machine

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

KeyBindings not working, but not on every machine

Thomas Lecocq
Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?

Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

bryce hendrix-2
On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
Bryce,

Any confirmation that it's a bug ?

Thanks

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 11 Feb 2010 17:00:24 +0000
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

bryce hendrix-2
Thomas Lecocq wrote:
Bryce,

Any confirmation that it's a bug ?

Yep, looks like a bug, but I'm not entirely sure where. Wx and focus seem to be inconsistent across platforms.

Do you want the key binding to work on the plot, or on the app? If you want it on the plot, I implemented a bit of a hack a couple of weeks ago for a similar problem which sets the focus when the mouse enters the plot container. This requires creating a tool and adding it to the plot, but thats only a few lines of code. Here a primitiv tool which just sets the focus:

class FocusTool(BaseTool):
    def normal_mouse_enter(self, event):
         """ Try to set the focus to the window when the mouse enters, otherwise
             the keypress events will not be triggered.
         """
         self.component.container._window._set_focus()

Bryce


Thanks

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 11 Feb 2010 17:00:24 +0000
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
Bryce,


Thomas Lecocq wrote:
Bryce,

Any confirmation that it's a bug ?

Yep, looks like a bug, but I'm not entirely sure where. Wx and focus seem to be inconsistent across platforms.

Do you want the key binding to work on the plot, or on the app? If you want it on the plot, I implemented a bit of a hack a couple of weeks ago for a similar problem which sets the focus when the mouse enters the plot container. This requires creating a tool and adding it to the plot, but thats only a few lines of code. Here a primitiv tool which just sets the focus:

class FocusTool(BaseTool):
    def normal_mouse_enter(self, event):
         """ Try to set the focus to the window when the mouse enters, otherwise
             the keypress events will not be triggered.
         """
         self.component.container._window._set_focus()

Bryce


I want the keys to work on the plot. I've tried your FocusTool, it does execute ( "print self.component.container" works) but the key bindings still don't work while the mouse is on the plot.


Should it work that way ? or do I have to specify something extra (in self.component.container._window._on_char() for example?)

Thanks

Thom






Thanks

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 11 Feb 2010 17:00:24 +0000
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
Some new info =

binding the key "r" does not work, but "Crtl-r" does !!!

Thomas



**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 17 Feb 2010 07:47:00 +0000
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,


Thomas Lecocq wrote:
Bryce,

Any confirmation that it's a bug ?

Yep, looks like a bug, but I'm not entirely sure where. Wx and focus seem to be inconsistent across platforms.

Do you want the key binding to work on the plot, or on the app? If you want it on the plot, I implemented a bit of a hack a couple of weeks ago for a similar problem which sets the focus when the mouse enters the plot container. This requires creating a tool and adding it to the plot, but thats only a few lines of code. Here a primitiv tool which just sets the focus:

class FocusTool(BaseTool):
    def normal_mouse_enter(self, event):
         """ Try to set the focus to the window when the mouse enters, otherwise
             the keypress events will not be triggered.
         """
         self.component.container._window._set_focus()

Bryce


I want the keys to work on the plot. I've tried your FocusTool, it does execute ( "print self.component.container" works) but the key bindings still don't work while the mouse is on the plot.


Should it work that way ? or do I have to specify something extra (in self.component.container._window._on_char() for example?)

Thanks

Thom






Thanks

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 11 Feb 2010 17:00:24 +0000
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: KeyBindings not working, but not on every machine

Thomas Lecocq
In reply to this post by Thomas Lecocq
Bryce,

I actually don't need the "FocusTool" to have the following to work :


####

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
  <a title="Envoyer (Ctrl+EntrĂ©e)" href="javascript:;" id="SendMessage"> Envoyer
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'Ctrl-d', # CTRL-D works, while D doesn't.
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 17 Feb 2010 12:06:18 -0600
From: [hidden email]
To: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Are you able to send me your updated example? If so, I'll take a look & hopefully be able to find the issue.

Bryce

Thomas Lecocq wrote:
Some new info =

binding the key "r" does not work, but "Crtl-r" does !!!

Thomas



**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 17 Feb 2010 07:47:00 +0000
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,


Thomas Lecocq wrote:
Bryce,

Any confirmation that it's a bug ?

Yep, looks like a bug, but I'm not entirely sure where. Wx and focus seem to be inconsistent across platforms.

Do you want the key binding to work on the plot, or on the app? If you want it on the plot, I implemented a bit of a hack a couple of weeks ago for a similar problem which sets the focus when the mouse enters the plot container. This requires creating a tool and adding it to the plot, but thats only a few lines of code. Here a primitiv tool which just sets the focus:

class FocusTool(BaseTool):
    def normal_mouse_enter(self, event):
         """ Try to set the focus to the window when the mouse enters, otherwise
             the keypress events will not be triggered.
         """
         self.component.container._window._set_focus()

Bryce


I want the keys to work on the plot. I've tried your FocusTool, it does execute ( "print self.component.container" works) but the key bindings still don't work while the mouse is on the plot.


Should it work that way ? or do I have to specify something extra (in self.component.container._window._on_char() for example?)

Thanks

Thom






Thanks

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 11 Feb 2010 17:00:24 +0000
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

Bryce,

This shows the problem :

from enthought.traits.api import *
from enthought.traits.ui.api import *
from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.enable.component_editor import ComponentEditor
from enthought.chaco.api import *

from numpy import arange, linspace, random

class CodeHandler(Handler, HasTraits):
    info = Any
   
    def action1(self,info):
        print info

 

class show_trace(HasTraits):
 
    command = Str
    container = Instance(VPlotContainer)
    pd = Instance(ArrayPlotData)
    plot1 = Instance(Plot)
 
    key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'action1'),
        )
       
    view = View(
        Item('container',editor=ComponentEditor()),Item('command'),
                    key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')
               
    def __init__(self):
        self.pd = ArrayPlotData()
        x = linspace(0,100,101)
        y = random.random_integers(-100,100,101)
        self.pd.set_data('index',x)
        self.pd.set_data('value',y)
        p = Plot(self.pd)
        p.plot(('index','value'))
        self.plot1 = p
        self.container = VPlotContainer()
        self.container.add(self.plot1)
       


S = show_trace()
S.configure_traits()




Date: Thu, 11 Feb 2010 10:21:25 -0600
From: [hidden email]
To: [hidden email]
CC: [hidden email]
Subject: Re: [Enthought-Dev] KeyBindings not working, but not on every machine

On 02/11/2010 09:42 AM, Thomas Lecocq wrote:
Dear all,

I found a solution for my problem : I have to add an extra text box and type the 'key' inside the texteditor. When the editor is active, the key bindings work well, otherwise, whenthe container has the focus, the bindings do not work.

Is it a bug ? or is it just linked to my config ?


Sounds like a bug, but I have little experience with key bindings at the Traits level. Can you post a complete example that we can run to confirm if it works for us or not?

Bryce


Cheers,

Thomas

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Wed, 10 Feb 2010 10:03:27 +0000
Subject: [Enthought-Dev] KeyBindings not working, but not on every machine

Dear all,

I've written a database frontend for our seismological catalogue, with the ability to get waveforms recorde at each station. On my winXP box, I've implemented key_bindings and added them to the view that contains the plots of the waveforms. The bindings work OK on the windows box (used for rotating the reference, calculation of the real displacement of the seismic station, etc.)

The thing is :

WinXP box, EPD 5.1, Wx, no problem

Debian server, Python2.5, ETS3.3.1, Wx2.8, no bindings
Debian server, Python2.5, ETS3.3.1, Qt4, bindings OK, but ESC key closes the window (where Wx resets the plot's ranges)

Any ideas ???

Thanks a lot !

Thomas


---

The bindings are defined as in the example :

from enthought.traits.ui.key_bindings import KeyBinding, KeyBindings
from enthought.traits.ui.api import Handler
from Restitution.restitution import *
key_bindings = KeyBindings(
    KeyBinding (binding1 = 'd',
                description = 'Restitution Displacement',
                method_name = 'displacement'),
               
    KeyBinding (binding2 = 'l',
                description = 'Lasso',
                method_name = 'lasso'),
                   
    KeyBinding (binding2 = 'r',
                description = 'Rotate Traces',
                method_name = 'rotate')
               
                )


and the CodeHandler :


class CodeHandler(Handler, HasTraits):
    L_O = Dict
    I_D1 = Instance(AbstractDataSource)
    I_D2 = Instance(AbstractDataSource)
    I_D3 = Instance(AbstractDataSource)

    info = Any
   
    def scatterplot(self,info,plot,index,value,name):

   
    def lasso(self,info):
       
    def _selection_changed(self):       

    def displacement(self,info):

    def rotate(self,info):


and finaly the View :

    view = View(Item('title',style='readonly',show_label=False),
        Tabbed(
        VGroup(HGroup(Item('filter_05Hz',show_label=False),Item('filter_2Hz',show_label=False),Item('filter_20Hz',show_label=False)),
        Item('container',editor=PlotContainerEditor(),show_label=False),label='Traces'),
        VGroup(Item('container2',editor=PlotContainerEditor(),show_label=False),
#     Item('code', editor=ShellEditor()),
        Item('di'),Item('di_clicked'),
        HGroup(Item('x2x1'),Item('y2y1'),Item('angle')),'export_vtk',
        label='Azimuth & Incidence'),
        VGroup(Item(name='mayavi',
                     editor=SceneEditor(),
                     show_label=False),label='3D-View')
        ),
                key_bindings = key_bindings,
                handler = CodeHandler(),
                resizable = True,
                buttons = ["OK"],
                width=1024,height=768,
                title='DB FrontEnd 2 - Show Trace')




**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************

_______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev




_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev