Add exception handling around pointer monitor

The pointer monitor isn't functional in guest sessions.
This commit is contained in:
Clement Lefebvre 2017-06-12 15:36:46 +01:00
parent 1d739da691
commit 0d3702b716

View File

@ -462,7 +462,6 @@ class MenuWin( object ):
self.mainwin = MainWindow( self.button_box, self.settings, self.keybinder, self.de ) self.mainwin = MainWindow( self.button_box, self.settings, self.keybinder, self.de )
self.mainwin.window.connect( "map-event", self.onWindowMap ) self.mainwin.window.connect( "map-event", self.onWindowMap )
self.mainwin.window.connect( "unmap-event", self.onWindowUnmap ) self.mainwin.window.connect( "unmap-event", self.onWindowUnmap )
self.mainwin.window.connect( "realize", self.onRealize )
self.mainwin.window.connect( "size-allocate", lambda *args: self.positionMenu() ) self.mainwin.window.connect( "size-allocate", lambda *args: self.positionMenu() )
self.mainwin.window.set_name("mintmenu") # Name used in Gtk RC files self.mainwin.window.set_name("mintmenu") # Name used in Gtk RC files
@ -475,8 +474,13 @@ class MenuWin( object ):
self.bind_hot_key() self.bind_hot_key()
self.applet.set_can_focus(False) self.applet.set_can_focus(False)
try:
self.pointerMonitor = pointerMonitor.PointerMonitor() self.pointerMonitor = pointerMonitor.PointerMonitor()
self.pointerMonitor.connect("activate", self.onPointerOutside) self.pointerMonitor.connect("activate", self.onPointerOutside)
self.mainwin.window.connect( "realize", self.onRealize )
except Exception, cause:
print "** WARNING ** - Pointer Monitor Error"
print "Error Report :\n", str(cause)
def onWindowMap( self, *args ): def onWindowMap( self, *args ):
self.applet.get_style_context().set_state( Gtk.StateFlags.SELECTED ) self.applet.get_style_context().set_state( Gtk.StateFlags.SELECTED )
@ -644,7 +648,6 @@ class MenuWin( object ):
except Exception, cause: except Exception, cause:
print "** WARNING ** - Menu Hotkey Binding Error" print "** WARNING ** - Menu Hotkey Binding Error"
print "Error Report :\n", str(cause) print "Error Report :\n", str(cause)
pass
def hotkeyChanged (self, schema, key): def hotkeyChanged (self, schema, key):
self.hotkeyText = self.settings.get_string( "hot-key" ) self.hotkeyText = self.settings.get_string( "hot-key" )