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
6f34ff8538
commit
2f1329de7d
@ -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 )
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class pluginclass( object ):
|
|||||||
print detail
|
print detail
|
||||||
self.currentFavCol = 0
|
self.currentFavCol = 0
|
||||||
self.favorites = []
|
self.favorites = []
|
||||||
|
|
||||||
self.content_holder.set_size_request( self.width, self.height )
|
self.content_holder.set_size_request( self.width, self.height )
|
||||||
self.categoriesBox.set_size_request( self.width / 3, -1 )
|
self.categoriesBox.set_size_request( self.width / 3, -1 )
|
||||||
self.applicationsBox.set_size_request( self.width / 2, -1 )
|
self.applicationsBox.set_size_request( self.width / 2, -1 )
|
||||||
@ -283,7 +283,7 @@ class pluginclass( object ):
|
|||||||
|
|
||||||
self.icon_theme = Gtk.IconTheme.get_default();
|
self.icon_theme = Gtk.IconTheme.get_default();
|
||||||
self.icon_theme.connect("changed", self.on_icon_theme_changed)
|
self.icon_theme.connect("changed", self.on_icon_theme_changed)
|
||||||
|
|
||||||
def refresh_apt_cache(self):
|
def refresh_apt_cache(self):
|
||||||
if self.useAPT:
|
if self.useAPT:
|
||||||
os.system("mkdir -p %s/.linuxmint/mintMenu/" % home)
|
os.system("mkdir -p %s/.linuxmint/mintMenu/" % home)
|
||||||
@ -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 ):
|
||||||
@ -1481,7 +1471,7 @@ class pluginclass( object ):
|
|||||||
self.favoritesReorder( favButton.position, position )
|
self.favoritesReorder( favButton.position, position )
|
||||||
|
|
||||||
self.favoritesSave()
|
self.favoritesSave()
|
||||||
|
|
||||||
def favoritesRemove( self, position ):
|
def favoritesRemove( self, position ):
|
||||||
tmp = self.favorites[ position ]
|
tmp = self.favorites[ position ]
|
||||||
self.favorites.remove( self.favorites[ position ] )
|
self.favorites.remove( self.favorites[ position ] )
|
||||||
|
Loading…
Reference in New Issue
Block a user