more ctypes for popup menus (not working yet)

This commit is contained in:
Michael Webster 2013-03-05 22:45:52 -05:00
parent 0583021023
commit b84bad70e0
3 changed files with 21 additions and 11 deletions

View File

@ -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

View File

@ -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()

View File

@ -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):