def __init__(self, parent, skinkey='AppDefaults.PrefCombo'): EventMixin.__init__(self) UberCombo.__init__(self, parent, self.no_connections_label, False, valuecallback=self._on_account_changed, skinkey=skinkey) profile.account_manager.connected_accounts.add_observer(self._on_connaccts_changed) self._on_connaccts_changed()
def __init__(self, parent, content_callback, objects = None): UberCombo.__init__(self, parent, skinkey = 'combobox', typeable = False, valuecallback = self.OnValue, selectioncallback = lambda item: self.ChangeValue(item)) self.remove_menu = SimpleMenu(self.menu, 'simplemenu',callback = self.OnRemove) self.content_cb = content_callback if objects is not None: self.SetList(objects)
def __init__(self, parent, skinkey='AppDefaults.PrefCombo'): EventMixin.__init__(self) UberCombo.__init__(self, parent, self.no_connections_label, False, valuecallback=self._on_account_changed, skinkey=skinkey) profile.account_manager.connected_accounts.add_observer( self._on_connaccts_changed) self._on_connaccts_changed()
def __init__(self, parent, skinkey=None, contacts=None, inviteCallback=None, accountCallback=None, model=None, use_confirm_dialog=True): if skinkey is None: skinkey = skin.get('RoomListComboSkin') UberCombo.__init__(self, parent, typeable=True, skinkey=skinkey, editmethod=self.EditField, selectioncallback=self.on_selection, maxmenuheight=10, minmenuwidth=230, empty_text=_('Invite Buddy')) self.TextField.Bind(wx.EVT_KEY_DOWN, self.OnKey) self.contacts = contacts if contacts is not None else {} self.inviteCallback = inviteCallback self.accountCallback = accountCallback self.model = model self.use_confirm_dialog = use_confirm_dialog #from util import trace #from gui.uberwidgets.simplemenu import SimpleMenu #trace(SimpleMenu) def EditField(): if not self.display.txtfld.IsShown(): self.display.TypeField() self.menu.BeforeDisplay += lambda: self.update_menu(self.TextField. Value) self.menu.BeforeDisplay += EditField
def __init__(self, parent, skinkey=None, contacts=None, inviteCallback=None, accountCallback=None, model=None, use_confirm_dialog=True): if skinkey is None: skinkey = skin.get('RoomListComboSkin') UberCombo.__init__(self, parent, typeable=True, skinkey=skinkey, editmethod=self.EditField, selectioncallback=self.on_selection, maxmenuheight=10, minmenuwidth=230, empty_text=_('Invite Buddy')) self.TextField.Bind(wx.EVT_KEY_DOWN, self.OnKey) self.contacts = contacts if contacts is not None else {} self.inviteCallback = inviteCallback self.accountCallback = accountCallback self.model = model self.use_confirm_dialog = use_confirm_dialog #from util import trace #from gui.uberwidgets.simplemenu import SimpleMenu #trace(SimpleMenu) def EditField(): if not self.display.txtfld.IsShown(): self.display.TypeField() self.menu.BeforeDisplay += lambda: self.update_menu(self.TextField.Value) self.menu.BeforeDisplay += EditField
def __init__(self, parent, buddylist, statuses, get_status_method=get_profile_status, set_status_method=set_profile_status): ''' StatusCombo constructor. parent - a wx.Window parent window statuses - an observable list of StatusMessage objects ''' self.buddylist = buddylist self.buddylist.Bind(wx.EVT_KEY_DOWN, self.on_buddylist_key) self.searching = False self.searchHintShown = False if not getattr(StatusCombo, 'searchThresholdRegistered', False) and pref('search.buddylist.show_hint', True): def SearchThresholdReached(*a, **k): if pref('search.buddylist.show_hint', True): setpref('search.buddylist.show_hint', False) Hook('digsby.achievements.threshold', 'buddylist.search').register(SearchThresholdReached) StatusCombo.searchThresholdRegistered = True self.offline_item = None self.get_profile_status = get_status_method self.set_profile_status = set_status_method status = self.get_profile_status() UberCombo.__init__(self, parent, skinkey='combobox', typeable=True, valuecallback=self.on_text_lose_focus, empty_text=getattr(status, 'hint', status.title.title()), maxmenuheight=15) self.buttoncallback = self.on_status_button self.cbutton = UberButton(self, -1, skin=self.cbuttonskin) self.cbutton.Bind(wx.EVT_BUTTON, self._on_left_button) self.content.Insert(0, self.cbutton, 0, wx.EXPAND) self.cbutton.BBind(RIGHT_UP=self.on_status_button_right_click, LEFT_DOWN=self.on_status_button_left_click, LEFT_UP=self.on_status_button_left_up) self.display.Bind( wx.EVT_LEFT_DOWN, lambda e: (e.Skip(), setattr(self, 'oldValue', self.Value))) # the on_allow_status_changes method is called when the list of connected # im accounts changes size. if all accounts are offline this control # becomes disabled.. #profile.account_manager.connected_accounts.add_observer(self.on_allow_status_changes) profile.account_manager.connected_accounts.add_observer( self.on_offline_allowed, obj=self) # Listen on status messages (changes, additions, deletes). _obs_link = statuses.add_list_observer(self.on_status_messages_changed, self.on_status_messages_changed) self.Bind( wx.EVT_WINDOW_DESTROY, lambda e: (log.info('status combo removing observers'), e.Skip(), _obs_link.disconnect())) self.on_status_messages_changed(statuses) # when the profile's status changes, update to reflect it profile.add_observer(self.on_profile_status_changed, 'status') # Display the current status. self.show_status(self.get_profile_status()) # Timer for committing status messages after a delay. self.timer = wx.PyTimer(self.SetFocus) self.Bind(wx.EVT_TEXT, self.on_typing) self.button_timer = wx.PyTimer(self.on_status_button_right_click) textbind = self.TextField.Bind textbind(wx.EVT_SET_FOCUS, lambda e: setattr(self, 'skipenter', False)) textbind(wx.EVT_KEY_DOWN, self._on_key_down) textbind(wx.EVT_TEXT_ENTER, self._on_enter) self.DropDownButton.Bind(wx.EVT_LEFT_DOWN, self._dbutton_left) self.OnActivateSearch = Delegate() self.OnDeactivateSearch = Delegate()
def __init__(self, parent, buddylist, statuses, get_status_method = get_profile_status, set_status_method = set_profile_status): ''' StatusCombo constructor. parent - a wx.Window parent window statuses - an observable list of StatusMessage objects ''' self.buddylist = buddylist self.buddylist.Bind(wx.EVT_KEY_DOWN, self.on_buddylist_key) self.searching = False self.searchHintShown = False if not getattr(StatusCombo, 'searchThresholdRegistered', False) and pref('search.buddylist.show_hint', True): def SearchThresholdReached(*a, **k): if pref('search.buddylist.show_hint', True): setpref('search.buddylist.show_hint', False) Hook('digsby.achievements.threshold', 'buddylist.search').register(SearchThresholdReached) StatusCombo.searchThresholdRegistered = True self.offline_item = None self.get_profile_status = get_status_method self.set_profile_status = set_status_method status = self.get_profile_status() UberCombo.__init__(self, parent, skinkey = 'combobox', typeable = True, valuecallback = self.on_text_lose_focus, empty_text=getattr(status, 'hint', status.title.title()), maxmenuheight = 15) self.buttoncallback = self.on_status_button self.cbutton = UberButton(self, -1, skin=self.cbuttonskin) self.cbutton.Bind(wx.EVT_BUTTON, self._on_left_button) self.content.Insert(0,self.cbutton, 0, wx.EXPAND) self.cbutton.BBind(RIGHT_UP = self.on_status_button_right_click, LEFT_DOWN = self.on_status_button_left_click, LEFT_UP = self.on_status_button_left_up) self.display.Bind(wx.EVT_LEFT_DOWN, lambda e: (e.Skip(), setattr(self, 'oldValue', self.Value))) # the on_allow_status_changes method is called when the list of connected # im accounts changes size. if all accounts are offline this control # becomes disabled.. #profile.account_manager.connected_accounts.add_observer(self.on_allow_status_changes) profile.account_manager.connected_accounts.add_observer(self.on_offline_allowed, obj = self) # Listen on status messages (changes, additions, deletes). _obs_link = statuses.add_list_observer(self.on_status_messages_changed, self.on_status_messages_changed) self.Bind(wx.EVT_WINDOW_DESTROY, lambda e: (log.info('status combo removing observers'), e.Skip(), _obs_link.disconnect())) self.on_status_messages_changed(statuses) # when the profile's status changes, update to reflect it profile.add_observer(self.on_profile_status_changed, 'status') # Display the current status. self.show_status(self.get_profile_status()) # Timer for committing status messages after a delay. self.timer = wx.PyTimer(self.SetFocus) self.Bind(wx.EVT_TEXT, self.on_typing) self.button_timer = wx.PyTimer(self.on_status_button_right_click) textbind = self.TextField.Bind textbind(wx.EVT_SET_FOCUS, lambda e: setattr(self, 'skipenter', False)) textbind(wx.EVT_KEY_DOWN, self._on_key_down) textbind(wx.EVT_TEXT_ENTER, self._on_enter) self.DropDownButton.Bind(wx.EVT_LEFT_DOWN, self._dbutton_left) self.OnActivateSearch = Delegate() self.OnDeactivateSearch = Delegate()