From b84bad70e0a13e5b7675d12085424c6373b6ee30 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Tue, 5 Mar 2013 22:45:52 -0500 Subject: [PATCH] more ctypes for popup menus (not working yet) --- usr/lib/linuxmint/mintMenu/mintMenu.py | 3 --- .../mintMenu/plugins/applications.py | 20 +++++++++++++------ usr/lib/linuxmint/mintMenu/plugins/places.py | 9 +++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 76b5759..8f66b9d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -493,7 +493,6 @@ class MainWindow( object ): def onButtonPress( self, widget, event ): # Check if the pointer is within the menu, else hide the menu - winatptr = Gdk.window_at_pointer() if winatptr: win = winatptr[0] @@ -604,7 +603,6 @@ class MenuWin( object ): tooltip = tooltip.replace("\"", "") self.systemlabel.set_tooltip_text(tooltip) self.button_icon.set_tooltip_text(tooltip) - if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: self.button_box = Gtk.HBox() self.button_box.pack_start( self.button_icon, False, False, 0 ) @@ -816,7 +814,6 @@ class MenuWin( object ): # Get the screen dimensions screenHeight = Gdk.Screen.height() screenWidth = Gdk.Screen.width() - if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: if entryX + ourWidth < screenWidth or entryX + entryWidth / 2 < screenWidth / 2: # Align to the left of the entry diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index b6875d9..40728b6 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -15,13 +15,16 @@ import threading import commands import subprocess import filecmp - +import ctypes +from ctypes import * from easybuttons import * from execute import Execute from easygsettings import EasyGSettings from easyfiles import * -#from filemonitor import monitor as filemonitor +gtk = CDLL("libgtk-x11-2.0.so.0") + +from filemonitor import monitor as filemonitor #import xdg.Menu import matemenu @@ -914,7 +917,8 @@ class pluginclass( object ): mTree.show_all() - mTree.popup( None, None, None, ev.button, ev.time ) + #mTree.popup( None, None, None, ev.button, ev.time ) + gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None) self.mintMenuWin.grab() else: @@ -931,7 +935,8 @@ class pluginclass( object ): removeMenuItem.connect( "activate", self.onFavoritesRemove, widget ) insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore ) insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, widget, insertBefore ) - mTree.popup( None, None, None, ev.button, ev.time ) + #mTree.popup( None, None, None, ev.button, ev.time ) + gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None) self.mintMenuWin.grab() def menuPopup( self, widget, event ): @@ -995,7 +1000,9 @@ class pluginclass( object ): startupMenuItem.connect( "toggled", self.onAddToStartup, widget ) mTree.connect( 'deactivate', self.onMenuPopupDeactivate) - mTree.popup( None, None, None, event.button, event.time ) + + gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None) + #mTree.popup( None, None, None, event.button, event.time ) def onMenuPopupDeactivate( self, widget): self.mintMenuWin.grab() @@ -1074,7 +1081,8 @@ class pluginclass( object ): menu.show_all() #menu.popup( None, None, self.pos_func, 3, 0) - menu.popup( None, None, None, 3, 0) + gtk.gtk_menu_popup(hash(menu), None, None, None, 3, 0) + #menu.popup( None, None, None, 3, 0) #menu.attach_to_widget(self.searchButton, None) #menu.reposition() #menu.reposition() diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 04739c3..c10164a 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -6,12 +6,16 @@ import string import gettext import commands import time +import ctypes +from ctypes import * from easybuttons import * from execute import Execute from user import home from urllib import unquote +gtk = CDLL("libgtk-x11-2.0.so.0") + # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") @@ -254,8 +258,9 @@ class pluginclass( object ): trashMenu.append(emptyTrashMenuItem) trashMenu.show_all() emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget ) - trashMenu.popup( None, None, None, event.button, event.time ) - self.mintMenuWin.grab() + gtk.gtk_menu_popup(hash(trashMenu), None, None, None, event.button, event.time) + #trashMenu.popup( None, None, None, event.button, event.time ) + # self.mintMenuWin.grab() def emptyTrash( self, menu, widget):