Fix some regressions

This commit is contained in:
Michael Webster 2013-03-06 18:23:28 -05:00
parent b84bad70e0
commit 12a30eb965
2 changed files with 47 additions and 44 deletions

View File

@ -201,11 +201,10 @@ class MainWindow( object ):
self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" ) self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" )
def SetupMintMenuBorder( self ): def SetupMintMenuBorder( self ):
# COMMENTED DURING MIGRATION if self.usecustomcolor:
#if self.usecustomcolor: self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
# self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) ) else:
#else: self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
# self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth ) self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth )
def SetupMintMenuOpacity( self ): def SetupMintMenuOpacity( self ):
@ -388,13 +387,12 @@ class MainWindow( object ):
for item in items: for item in items:
if item not in self.panesToColor: if item not in self.panesToColor:
self.panesToColor.append( item ) self.panesToColor.append( item )
#COMMENTED DURING MIGRATION if self.usecustomcolor:
#if self.usecustomcolor: for item in items:
# for item in items: item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
# item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) ) else:
#else: for item in items:
# for item in items: item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
# item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
def SetHeadingStyle( self, items ): def SetHeadingStyle( self, items ):
@ -460,19 +458,18 @@ class MainWindow( object ):
self.plugins["applications"].focusSearchEntry() self.plugins["applications"].focusSearchEntry()
def grab( self ): def grab( self ):
Gdk.pointer_grab( self.window.window, True, Gdk.EventMask.BUTTON_PRESS_MASK ) Gdk.pointer_grab( self.window.window, True, Gdk.EventMask.BUTTON_PRESS_MASK, self.window.window, Gdk.Cursor(Gdk.CursorType.ARROW), Gdk.CURRENT_TIME)
Gdk.keyboard_grab( self.window.window, False ) Gdk.keyboard_grab( self.window.window, False, Gdk.CURRENT_TIME )
self.window.grab_add() Gtk.grab_add(self.window)
def ungrab( self ): def ungrab( self ):
self.window.grab_remove() Gtk.grab_remove(self.window)
self.window.hide() self.window.hide()
Gdk.pointer_ungrab() Gdk.pointer_ungrab(Gdk.CURRENT_TIME)
Gdk.keyboard_ungrab() Gdk.keyboard_ungrab(Gdk.CURRENT_TIME)
def onMap( self, widget, event ): def onMap( self, widget, event ):
#self.grab() COMMENTED DURING MIGRATION self.grab()
pass
def onShow( self, widget ): def onShow( self, widget ):
for plugin in self.plugins.values(): for plugin in self.plugins.values():
@ -480,7 +477,7 @@ class MainWindow( object ):
plugin.onShowMenu() plugin.onShowMenu()
def onUnmap( self, widget, event ): def onUnmap( self, widget, event ):
#self.ungrab() COMMENTED DURING MIGRATION self.ungrab()
for plugin in self.plugins.values(): for plugin in self.plugins.values():
if hasattr( plugin, "onHideMenu" ): if hasattr( plugin, "onHideMenu" ):
@ -508,9 +505,9 @@ class MainWindow( object ):
return True return True
def onGrabBroken( self, widget, event ): def onGrabBroken( self, widget, event ):
if event.grab_window: if event.grab_broken.grab_window:
try: try:
theft = event.grab_window.get_user_data() theft = event.grab_broken.grab_window.get_user_data()
theft.connect( "event", self.onGrabTheftEvent ) theft.connect( "event", self.onGrabTheftEvent )
except: except:
self.window.hide( True ) self.window.hide( True )
@ -727,19 +724,23 @@ class MenuWin( object ):
self.button_icon.hide() self.button_icon.hide()
else: else:
self.button_icon.show() self.button_icon.show()
# COMMENTED DURING MIGRATION
# This code calculates width and height for the button_box # This code calculates width and height for the button_box
# and takes the orientation in account # and takes the orientation in account
#if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN: sl_req = Gtk.Requisition()
# if self.hideIcon: bi_req = Gtk.Requisition()
# self.applet.set_size_request( self.systemlabel.size_request()[0] + 2, -1 ) self.button_icon.size_request(bi_req)
# else: self.systemlabel.size_request(sl_req)
# self.applet.set_size_request( self.systemlabel.size_request()[0] + self.button_icon.size_request()[0] + 5, self.button_icon.size_request()[1] ) if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
#else: if self.hideIcon:
# if self.hideIcon: self.systemlabel.size_request(sl_req)
# self.applet.set_size_request( self.button_icon.size_request()[0], self.systemlabel.size_request()[1] + 2 ) self.applet.set_size_request( sl_req.width + 2, -1 )
# else: else:
# self.applet.set_size_request( self.button_icon.size_request()[0], self.systemlabel.size_request()[1] + self.button_icon.size_request()[1] + 5 ) self.applet.set_size_request( sl_req.width + bi_req.width + 5, bi_req.height )
else:
if self.hideIcon:
self.applet.set_size_request( bi_req.width, sl_req.height + 2 )
else:
self.applet.set_size_request( bi_req.width, sl_req.height + bi_req.height + 5 )
def reloadSettings( self, *args ): def reloadSettings( self, *args ):
self.loadSettings() self.loadSettings()

View File

@ -854,11 +854,11 @@ class pluginclass( object ):
# Forward all text to the search box # Forward all text to the search box
def keyPress( self, widget, event ): def keyPress( self, widget, event ):
if event.string.strip() != "" or event.keyval == gtk.keysyms.BackSpace: if event.string.strip() != "" or event.keyval == Gdk.KEY_BackSpace:
self.searchEntry.event( event ) self.searchEntry.event( event )
return True return True
if event.keyval == gtk.keysyms.Down and self.searchEntry.is_focus(): if event.keyval == Gdk.KEY_Down and self.searchEntry.is_focus():
self.applicationsBox.get_children()[0].grab_focus() self.applicationsBox.get_children()[0].grab_focus()
return False return False
@ -936,13 +936,13 @@ class pluginclass( object ):
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) gtk.gtk_menu_popup(hash(mTree), None, None, None, ev.button, ev.time)
self.mintMenuWin.grab() self.mintMenuWin.grab()
return True
def menuPopup( self, widget, event ): def menuPopup( self, widget, event ):
if event.button == 3: if event.button == 3:
mTree = self.builder.get_object ( "applicationsMenu" ) mTree = self.builder.get_object ( "applicationsMenu" )
#i18n #i18n
desktopMenuItem = Gtk.MenuItem(_("Add to desktop")) desktopMenuItem = Gtk.MenuItem(_("Add to desktop"))
panelMenuItem = Gtk.MenuItem(_("Add to panel")) panelMenuItem = Gtk.MenuItem(_("Add to panel"))
@ -1000,11 +1000,12 @@ 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)
gtk.gtk_menu_popup(hash(mTree), None, hash(widget), None, 0, event.time)
gtk.gtk_menu_popup(hash(mTree), None, None, None, None, None) #mTree.popup_for_device( None, None, None, event.button, event.time )
#mTree.popup( None, None, None, event.button, event.time ) return True
def onMenuPopupDeactivate( self, widget): def onMenuPopupDeactivate( self, widget):
print "what"
self.mintMenuWin.grab() self.mintMenuWin.grab()
def searchPopup( self, widget=None, event=None ): def searchPopup( self, widget=None, event=None ):
@ -1088,6 +1089,7 @@ class pluginclass( object ):
#menu.reposition() #menu.reposition()
self.mintMenuWin.grab() self.mintMenuWin.grab()
self.focusSearchEntry() self.focusSearchEntry()
return True
def pos_func(self, menu=None): def pos_func(self, menu=None):
rect = self.searchButton.get_allocation() rect = self.searchButton.get_allocation()
@ -1314,7 +1316,7 @@ class pluginclass( object ):
# Scroll button into view # Scroll button into view
def scrollItemIntoView( self, widget, event = None ): def scrollItemIntoView( self, widget, event = None ):
viewport = widget.parent viewport = widget.parent
while not isinstance( viewport, gtk.Viewport ): while not isinstance( viewport, Gtk.Viewport ):
if not viewport.parent: if not viewport.parent:
return return
viewport = viewport.parent viewport = viewport.parent