class MenuWin(object): def __init__(self, applet, iid): self.applet = applet self.detect_desktop_environment() self.settings = Gio.Settings.new("com.linuxmint.mintmenu") self.loadSettings() self.createPanelButton() self.mate_settings = Gio.Settings.new("org.mate.interface") self.mate_settings.connect("changed::gtk-theme", self.changeTheme) self.settings.connect("changed::applet-text", self.reloadSettings) self.settings.connect("changed::theme-name", self.changeTheme) self.settings.connect("changed::hot-key", self.reloadSettings) self.settings.connect("changed::applet-icon", self.reloadSettings) self.settings.connect("changed::hide-applet-icon", self.reloadSettings) self.settings.connect("changed::applet-icon-size", self.reloadSettings) self.applet.set_flags(MatePanelApplet.AppletFlags.EXPAND_MINOR) self.applet.connect("button-press-event", self.showMenu) self.applet.connect("change-orient", self.changeOrientation) self.applet.connect("enter-notify-event", self.enter_notify) self.applet.connect("leave-notify-event", self.leave_notify) self.mainwin = MainWindow(self.button_box, self.settings, self.de) self.mainwin.window.connect("map-event", self.onWindowMap) self.mainwin.window.connect("unmap-event", self.onWindowUnmap) self.mainwin.window.connect("size-allocate", lambda *args: self.positionMenu()) self.mainwin.window.set_name("mintmenu") # Name used in Gtk RC files self.applyTheme() self.mainwin.loadTheme() if self.mainwin.icon: Gtk.Window.set_default_icon_name(self.mainwin.icon) try: self.keybinder = keybinding.GlobalKeyBinding() if self.hotkeyText != "": self.keybinder.grab(self.hotkeyText) self.keybinder.connect("activate", self.onBindingPress) self.keybinder.start() self.settings.connect("changed::hot-key", self.hotkeyChanged) print "Binding to Hot Key: " + self.hotkeyText except Exception, cause: self.keybinder = None print "** WARNING ** - Keybinder Error" print "Error Report :\n", str(cause) self.applet.set_can_focus(False) try: self.pointerMonitor = pointerMonitor.PointerMonitor() 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 __init__( self, applet, iid ): self.applet = applet self.detect_desktop_environment() self.settings = Gio.Settings.new("com.linuxmint.mintmenu") self.keybinder = keybinding.GlobalKeyBinding() self.loadSettings() self.createPanelButton() self.mate_settings = Gio.Settings.new("org.mate.interface") self.mate_settings.connect( "changed::gtk-theme", self.changeTheme ) self.settings.connect( "changed::applet-text", self.reloadSettings ) self.settings.connect( "changed::theme-name", self.changeTheme ) self.settings.connect( "changed::hot-key", self.reloadSettings ) self.settings.connect( "changed::applet-icon", self.reloadSettings ) self.settings.connect( "changed::hide-applet-icon", self.reloadSettings ) self.settings.connect( "changed::applet-icon-size", self.reloadSettings ) self.settings.connect( "changed::hot-key", self.hotkeyChanged ) self.applet.set_flags( MatePanelApplet.AppletFlags.EXPAND_MINOR ) self.applet.connect( "button-press-event", self.showMenu ) self.applet.connect( "change-orient", self.changeOrientation ) self.applet.connect("enter-notify-event", self.enter_notify) self.applet.connect("leave-notify-event", self.leave_notify) self.mainwin = MainWindow( self.button_box, self.settings, self.keybinder, self.de ) self.mainwin.window.connect( "map-event", self.onWindowMap ) 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.set_name("mintmenu") # Name used in Gtk RC files self.applyTheme() self.mainwin.loadTheme() if self.mainwin.icon: Gtk.Window.set_default_icon_name( self.mainwin.icon ) self.bind_hot_key() self.applet.set_can_focus(False) self.pointerMonitor = pointerMonitor.PointerMonitor() self.pointerMonitor.connect("activate", self.onPointerOutside)