Example #1
0
    def __init__(self,
                 parent,
                 notifications,
                 for_contact=None,
                 plusminus_buttons=None):
        TreeList.__init__(self, parent, TreeListModel(), style=wx.NO_BORDER)
        InstanceTracker.track(self)

        if for_contact is not None and not hasattr(for_contact, 'idstr'):
            raise TypeError(
                'for_contact must be a contact, a metacontact, or None')

        # if for_contact is None we'll show both global ztnotifications and
        # notifications for each contact
        info('showing notifications for %s',
             'everybody' if for_contact is None else for_contact.idstr())
        self.for_contact = for_contact
        self.notifications = notifications

        if plusminus_buttons is not None:
            plus, minus = plusminus_buttons
            plus.Bind(wx.EVT_BUTTON, self.on_add)
            minus.Bind(wx.EVT_BUTTON, self.on_remove)
            #TODO: disable add/deleted when no not. is selected

        self.update_view()

        self.BBind(LEFT_DCLICK=self.on_add_or_edit,
                   LEFT_DOWN=self.on_left_down,
                   LISTBOX=self.on_selection)

        self.SetDrawCallback(self.cskin_drawcallback)
Example #2
0
    def __init__(self,
                 parent,
                 label='',
                 id=None,
                 onshow=None,
                 windowless=None):

        if not isinstance(parent, wx.WindowClass):
            raise TypeError('UMenu parent must be a wx.Window')

        wx.Menu.__init__(self, label)

        InstanceTracker.track(self)

        if not isinstance(id, (int, type(None))):
            raise TypeError

        self._parentmenu = self._childmenu = None
        self.Id = wx.NewId() if id is None else id
        self._window = ref(parent)
        self.OnDismiss = Delegate()
        self.cbs = {}

        #self.Bind(wx.EVT_MENU, lambda e: menuEventHandler(self.InvokingWindow).ProcessEvent(e))

        if onshow is not None:
            self.Handler.AddShowCallback(self.Id,
                                         lambda menu=ref(self): onshow(menu()))

        if wxMSW:
            self.Handler.hwndMap[self.HMenu] = self

        self.Windowless = windowless

        self.UpdateSkin()
Example #3
0
    def __init__(self, parent, notifications, for_contact = None, plusminus_buttons = None):
        TreeList.__init__(self, parent, TreeListModel(), style = wx.NO_BORDER)
        InstanceTracker.track(self)

        if for_contact is not None and not hasattr(for_contact, 'idstr'):
            raise TypeError('for_contact must be a contact, a metacontact, or None')

        # if for_contact is None we'll show both global ztnotifications and
        # notifications for each contact
        info('showing notifications for %s', 'everybody' if for_contact is None else for_contact.idstr())
        self.for_contact = for_contact
        self.notifications = notifications

        if plusminus_buttons is not None:
            plus, minus = plusminus_buttons
            plus.Bind(wx.EVT_BUTTON, self.on_add)
            minus.Bind(wx.EVT_BUTTON, self.on_remove)
            #TODO: disable add/deleted when no not. is selected

        self.update_view()

        self.BBind(LEFT_DCLICK = self.on_add_or_edit,
                   LEFT_DOWN   = self.on_left_down,
                   LISTBOX     = self.on_selection)

        self.SetDrawCallback(self.cskin_drawcallback)
Example #4
0
    def __init__(self, parent, label = '', id = None, onshow = None, windowless = None):

        if not isinstance(parent, wx.WindowClass):
            raise TypeError('UMenu parent must be a wx.Window')

        wx.Menu.__init__(self, label)

        InstanceTracker.track(self)

        if not isinstance(id, (int, type(None))):
            raise TypeError

        self._parentmenu = self._childmenu = None
        self.Id          = wx.NewId() if id is None else id
        self._window     = ref(parent)
        self.OnDismiss   = Delegate()
        self.cbs = {}

        #self.Bind(wx.EVT_MENU, lambda e: menuEventHandler(self.InvokingWindow).ProcessEvent(e))

        if onshow is not None:
            self.Handler.AddShowCallback(self.Id, lambda menu=ref(self): onshow(menu()))

        if wxMSW:
            self.Handler.hwndMap[self.HMenu] = self

        self.Windowless = windowless

        self.UpdateSkin()
Example #5
0
    def __init__(self, parent, pos = wx.DefaultPosition):
        wx.Panel.__init__(self, parent, pos = (-300, -300))
        InstanceTracker.track(self)

        self.BackgroundStyle = wx.BG_STYLE_CUSTOM
        self.Sizer = BoxSizer(VERTICAL)
        self.showncontrol = None

        self.link_observers()
        self.construct_gui()
        self.setup_delegation()

        ImWinCtrl.__init__(self)
        imwinmenu.add_menus(self)

        metrics.event('IM Window Opened')

        self.UpdateSkin()

        self.IMControl.OnSelection += self.on_im_to_changed

        self.Bind(wx.EVT_SIZE, self.OnSize)