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 ): def onButtonPress( self, widget, event ):
# Check if the pointer is within the menu, else hide the menu # Check if the pointer is within the menu, else hide the menu
winatptr = Gdk.window_at_pointer() winatptr = Gdk.window_at_pointer()
if winatptr: if winatptr:
win = winatptr[0] win = winatptr[0]
@ -604,7 +603,6 @@ class MenuWin( object ):
tooltip = tooltip.replace("\"", "") tooltip = tooltip.replace("\"", "")
self.systemlabel.set_tooltip_text(tooltip) self.systemlabel.set_tooltip_text(tooltip)
self.button_icon.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: if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
self.button_box = Gtk.HBox() self.button_box = Gtk.HBox()
self.button_box.pack_start( self.button_icon, False, False, 0 ) self.button_box.pack_start( self.button_icon, False, False, 0 )
@ -816,7 +814,6 @@ class MenuWin( object ):
# Get the screen dimensions # Get the screen dimensions
screenHeight = Gdk.Screen.height() screenHeight = Gdk.Screen.height()
screenWidth = Gdk.Screen.width() screenWidth = Gdk.Screen.width()
if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: 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: if entryX + ourWidth < screenWidth or entryX + entryWidth / 2 < screenWidth / 2:
# Align to the left of the entry # Align to the left of the entry

View File

@ -15,13 +15,16 @@ import threading
import commands import commands
import subprocess import subprocess
import filecmp import filecmp
import ctypes
from ctypes import *
from easybuttons import * from easybuttons import *
from execute import Execute from execute import Execute
from easygsettings import EasyGSettings from easygsettings import EasyGSettings
from easyfiles import * 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 xdg.Menu
import matemenu import matemenu
@ -914,7 +917,8 @@ class pluginclass( object ):
mTree.show_all() 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() self.mintMenuWin.grab()
else: else:
@ -931,7 +935,8 @@ class pluginclass( object ):
removeMenuItem.connect( "activate", self.onFavoritesRemove, widget ) removeMenuItem.connect( "activate", self.onFavoritesRemove, widget )
insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore ) insertSpaceMenuItem.connect( "activate", self.onFavoritesInsertSpace, widget, insertBefore )
insertSeparatorMenuItem.connect( "activate", self.onFavoritesInsertSeparator, 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() self.mintMenuWin.grab()
def menuPopup( self, widget, event ): def menuPopup( self, widget, event ):
@ -995,7 +1000,9 @@ class pluginclass( object ):
startupMenuItem.connect( "toggled", self.onAddToStartup, widget ) startupMenuItem.connect( "toggled", self.onAddToStartup, widget )
mTree.connect( 'deactivate', self.onMenuPopupDeactivate) 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): def onMenuPopupDeactivate( self, widget):
self.mintMenuWin.grab() self.mintMenuWin.grab()
@ -1074,7 +1081,8 @@ class pluginclass( object ):
menu.show_all() menu.show_all()
#menu.popup( None, None, self.pos_func, 3, 0) #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.attach_to_widget(self.searchButton, None)
#menu.reposition() #menu.reposition()
#menu.reposition() #menu.reposition()

View File

@ -6,12 +6,16 @@ import string
import gettext import gettext
import commands import commands
import time import time
import ctypes
from ctypes import *
from easybuttons import * from easybuttons import *
from execute import Execute from execute import Execute
from user import home from user import home
from urllib import unquote from urllib import unquote
gtk = CDLL("libgtk-x11-2.0.so.0")
# i18n # i18n
gettext.install("mintmenu", "/usr/share/linuxmint/locale") gettext.install("mintmenu", "/usr/share/linuxmint/locale")
@ -254,8 +258,9 @@ class pluginclass( object ):
trashMenu.append(emptyTrashMenuItem) trashMenu.append(emptyTrashMenuItem)
trashMenu.show_all() trashMenu.show_all()
emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget ) emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget )
trashMenu.popup( None, None, None, event.button, event.time ) gtk.gtk_menu_popup(hash(trashMenu), None, None, None, event.button, event.time)
self.mintMenuWin.grab() #trashMenu.popup( None, None, None, event.button, event.time )
# self.mintMenuWin.grab()
def emptyTrash( self, menu, widget): def emptyTrash( self, menu, widget):