Applications: Fix keypress event handler (#205)
* Applications: Fix keypress event handler * further fix and simplify the keypress handler * disconnect the keyPress handler when destroying the plugin
This commit is contained in:
parent
02f49184ed
commit
df1460d7c5
@ -215,7 +215,7 @@ class pluginclass( object ):
|
|||||||
self.filterTimer = None
|
self.filterTimer = None
|
||||||
self.menuChangedTimer = None
|
self.menuChangedTimer = None
|
||||||
# Hookup for text input
|
# Hookup for text input
|
||||||
self.content_holder.connect( "key-press-event", self.keyPress )
|
self.keyPress_handler = self.mintMenuWin.window.connect( "key-press-event", self.keyPress )
|
||||||
|
|
||||||
self.favoritesBox.connect( "drag-data-received", self.ReceiveCallback )
|
self.favoritesBox.connect( "drag-data-received", self.ReceiveCallback )
|
||||||
|
|
||||||
@ -324,6 +324,8 @@ class pluginclass( object ):
|
|||||||
self.categoriesBox.destroy()
|
self.categoriesBox.destroy()
|
||||||
self.favoritesBox.destroy()
|
self.favoritesBox.destroy()
|
||||||
|
|
||||||
|
self.mintMenuWin.window.disconnect(self.keyPress_handler)
|
||||||
|
|
||||||
self.settings.notifyRemoveAll()
|
self.settings.notifyRemoveAll()
|
||||||
|
|
||||||
def changePluginSize( self, settings, key, args ):
|
def changePluginSize( self, settings, key, args ):
|
||||||
@ -843,23 +845,11 @@ class pluginclass( object ):
|
|||||||
self.searchEntry.set_text( "" )
|
self.searchEntry.set_text( "" )
|
||||||
self.Filter( widget, category )
|
self.Filter( widget, category )
|
||||||
|
|
||||||
# Forward all text to the search box
|
|
||||||
def keyPress( self, widget, event ):
|
def keyPress( self, widget, event ):
|
||||||
|
""" Forward all text to the search box """
|
||||||
if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace:
|
if event.string.strip() or event.keyval == Gdk.KEY_space:
|
||||||
self.searchEntry.grab_focus()
|
|
||||||
self.searchEntry.set_position( -1 )
|
|
||||||
self.searchEntry.event( event )
|
self.searchEntry.event( event )
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
if event.keyval == Gdk.KEY_space:
|
|
||||||
self.searchEntry.event( event )
|
|
||||||
return True
|
|
||||||
|
|
||||||
if event.keyval == Gdk.KEY_Down and self.searchEntry.is_focus():
|
|
||||||
self.applicationsBox.get_children()[0].grab_focus()
|
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def favPopup( self, widget, event ):
|
def favPopup( self, widget, event ):
|
||||||
|
Loading…
Reference in New Issue
Block a user