def AddMenuButton( self, label, menu_items, enabled_only_on_selection = False, enabled_check_func = None ): button = ClientGUICommon.MenuButton( self, label, menu_items ) self._AddButton( button, enabled_only_on_selection = enabled_only_on_selection, enabled_check_func = enabled_check_func ) self._UpdateButtons()
def __init__(self, parent, service): ClientGUICommon.StaticBox.__init__(self, parent, 'serverside hydrus account') self._service = service self._my_updater = ClientGUICommon.ThreadToGUIUpdater( self, self._Refresh) self._title_and_expires_st = wx.StaticText(self) self._status_st = wx.StaticText(self) self._next_sync_st = wx.StaticText(self) self._bandwidth_summary = wx.StaticText(self) self._bandwidth_panel = wx.Panel(self) self._refresh_account_button = ClientGUICommon.BetterButton( self, 'refresh account', self._RefreshAccount) self._copy_account_key_button = ClientGUICommon.BetterButton( self, 'copy account key', self._CopyAccountKey) self._permissions_button = ClientGUICommon.MenuButton( self, 'see special permissions', []) # self._Refresh() # hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.AddF(self._refresh_account_button, CC.FLAGS_LONE_BUTTON) hbox.AddF(self._copy_account_key_button, CC.FLAGS_LONE_BUTTON) hbox.AddF(self._permissions_button, CC.FLAGS_LONE_BUTTON) self.AddF(self._title_and_expires_st, CC.FLAGS_EXPAND_PERPENDICULAR) self.AddF(self._status_st, CC.FLAGS_EXPAND_PERPENDICULAR) self.AddF(self._next_sync_st, CC.FLAGS_EXPAND_PERPENDICULAR) self.AddF(self._bandwidth_summary, CC.FLAGS_EXPAND_PERPENDICULAR) self.AddF(self._bandwidth_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) self.AddF(hbox, CC.FLAGS_BUTTON_SIZER) HydrusGlobals.client_controller.sub(self, 'Update', 'service_updated')