def _win_update_menubar(self): #print "Window._win_update_menubar:", self ### if self._win_need_menubar_update: all_menus = application()._effective_menus_for_window(self) self._all_menus = all_menus if self._win_has_menubar: if all_menus: menubar = MenuBar() for menu in all_menus: menubar.append_menu(menu) self._win.SetMenu(menubar.win_menu) self._win_menubar = menubar else: self._win_set_empty_menubar() self._win_need_menubar_update = False
def _win_update_menubar(self): # print "Window._win_update_menubar:", self ### if self._win_need_menubar_update: all_menus = application()._effective_menus_for_window(self) self._all_menus = all_menus if self._win_has_menubar: if all_menus: menubar = MenuBar() for menu in all_menus: menubar.append_menu(menu) self._win.SetMenu(menubar.win_menu) self._win_menubar = menubar else: self._win_set_empty_menubar() self._win_need_menubar_update = False
def _win_set_empty_menubar(self): # A completely empty menu bar collapses to zero height, and # controlling the window bounds is too complicated if the # menu bar comes and goes, so we add a dummy item to it. menubar = MenuBar() menubar.win_menu.AppendMenu(0, 0, "") self._win.SetMenu(menubar.win_menu) self._win_menubar = menubar