Example #1
0
    def __init__(self,parent,name,associate,bitmap=None,checkcallback=None):
        SimplePanel.__init__(self,parent,FULL_REPAINT_ON_RESIZE)

        s = self.Sizer = wx.BoxSizer(HORIZONTAL)

        self.checkcallback = checkcallback
        checkbox = self.checkbox = wx.CheckBox(self,-1)
        checkbox.Bind(wx.EVT_CHECKBOX,self.OnCheck)

        self.MinSize = wx.Size(-1, 22)

        s.Add(checkbox,0,LEFT|ALIGN_CENTER_VERTICAL,3)

        self.name = name

        self.associate = associate

        self.bitmap = bitmap


        self.checkbox.Value=False
        self.checkcallback(self.associate, self.checkbox.Value)

        Bind = self.Bind
        Bind(wx.EVT_PAINT,self.OnPaint)
        Bind(wx.EVT_LEFT_UP, lambda e: self.Check(not self.checkbox.Value))
Example #2
0
    def __init__(self,
                 parent,
                 name,
                 associate,
                 bitmap=None,
                 checkcallback=None):
        SimplePanel.__init__(self, parent, FULL_REPAINT_ON_RESIZE)

        s = self.Sizer = wx.BoxSizer(HORIZONTAL)

        self.checkcallback = checkcallback
        checkbox = self.checkbox = wx.CheckBox(self, -1)
        checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheck)

        self.MinSize = wx.Size(-1, 22)

        s.Add(checkbox, 0, LEFT | ALIGN_CENTER_VERTICAL, 3)

        self.name = name

        self.associate = associate

        self.bitmap = bitmap

        self.checkbox.Value = False
        self.checkcallback(self.associate, self.checkbox.Value)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)
        Bind(wx.EVT_LEFT_UP, lambda e: self.Check(not self.checkbox.Value))
Example #3
0
    def __init__(self, parent, panel, size = wx.DefaultSize):
#        wx.Panel.__init__(self, parent, size=size)
        SimplePanel.__init__(self, parent)
        self.Show(False)

        do(self.Bind(event, method) for (event,method) in (
            (wx.EVT_CLOSE, self.OnClose),
        ))

        panel.Reparent(self)
        self.Sizer=wx.BoxSizer(wx.VERTICAL)
        self.Sizer.Add(panel, 1, wx.EXPAND)
        #panel.Show(True)

        self.panel=panel

        self.name  = getattr(panel, 'name', getattr(panel, 'Title', u''))

        from gui import skin
        self.icon  = skin.get('BuddiesPanel.BuddyIcons.NoIcon').WXB

        self.nicon = None
        self.notified = False

        self.tab = None

        panel.update_icon()
        panel.update_title()
Example #4
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        content = self.content = wx.BoxSizer(wx.VERTICAL)

        self.SetSkinKey('AccountPanels', True)

        cl = self.cl = ConnectionList(self)
        content.Add(cl, 1, wx.EXPAND)

        statebutton = self.statebutton = UberButton(self,
                                                    icon=self.iconshow,
                                                    skin=self.buttonskin)
        self.button_has_been_pressed = False
        statebutton.Bind(wx.EVT_BUTTON, self.__OnButtonClick)

        if self.expandup:
            content.Add(statebutton, 0, wx.EXPAND)
        else:
            content.Insert(0, statebutton, 0, wx.EXPAND)

        self.Sizer = MarginSizer(self.framesize, content)

        Bind = self.Bind
        Bind(wx.EVT_SIZE, self.OnSize)
        Bind(wx.EVT_PAINT, self.OnPaint)

        profile.prefs.add_observer(self.WhenOrderChanges,
                                   'buddylist.order')  #@UndefinedVariable
Example #5
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        content = self.content = wx.BoxSizer(wx.VERTICAL)

        self.SetSkinKey('AccountPanels', True)

        cl = self.cl = ConnectionList(self)
        content.Add(cl, 1, wx.EXPAND)

        statebutton = self.statebutton = UberButton(self, icon = self.iconshow, skin = self.buttonskin)
        self.button_has_been_pressed = False
        statebutton.Bind(wx.EVT_BUTTON, self.__OnButtonClick)

        if self.expandup:
            content.Add(statebutton, 0, wx.EXPAND)
        else:
            content.Insert(0, statebutton, 0, wx.EXPAND)

        self.Sizer = MarginSizer(self.framesize, content)

        Bind = self.Bind
        Bind(wx.EVT_SIZE,  self.OnSize)
        Bind(wx.EVT_PAINT, self.OnPaint)

        profile.prefs.add_observer(self.WhenOrderChanges,'buddylist.order') #@UndefinedVariable
Example #6
0
    def __init__(self,
                 parent,
                 label='',
                 callapsedicon=None,
                 expandedicon=None):
        SimplePanel.__init__(self, parent)

        self.callapsedicon = callapsedicon or skin.get(
            'AppDefaults.icons.chevroncolapsed')
        self.expandedicon = expandedicon or skin.get(
            'AppDefaults.icons.chevronexpanded')
        self.Label = label
        self._expanded = False

        self.CalcSize()

        self.isdown = False

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)
        Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        Bind(wx.EVT_LEFT_DCLICK, self.OnDClick)
        Bind(wx.EVT_ENTER_WINDOW, self.OnMouseIn)
        Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseOut)
Example #7
0
    def __init__(self, parent, id = wx.ID_ANY, skinkey = None, overflowmode = False,
                 name = 'UberBar', alignment = None):

        SimplePanel.__init__(self, parent, FULL_REPAINT_ON_RESIZE)
        UberWidget.__init__(self,'toolbar')

        self.ChildPaints = Delegate()

        # Initing variables
        self.alignment = alignment if alignment and not overflowmode else ALIGN_LEFT
        self.overflowmode   = overflowmode
        self.navimode       = False
        self.active         = None
        self.children       = []
        self.staticchildren = []
        self.overflowed     = []
        self.focus          = None
        self.lastheight     = 0


        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnBGPaint)
        Bind(wx.EVT_SIZE,  self.OnReSize)

        self.keyletters={}

        self.tlmargins = Size()
        self.brmargins = Size()

        #Start setting up an alternaitve Native Menubar for native mode

        self.SetSkinKey(skinkey,True)

        self.content = wx.BoxSizer(HORIZONTAL)
        sizer = self.Sizer = wx.GridBagSizer()
        sizer.SetEmptyCellSize(wx.Size(0, 0))

        contentFlag = TOP | BOTTOM | (self.alignment | EXPAND if self.alignment == ALIGN_LEFT else self.alignment)

        sizer.Add(self.content,(1,1),flag = contentFlag, border = self.padding.y)
        sizer.Add(Size(self.margins.left,self.margins.top),(0,0))
        sizer.Add(Size(self.margins.right,self.margins.bottom),(2,2))
        sizer.AddGrowableCol(1, 1)
        sizer.AddGrowableRow(1, 1)
#

        #Set up the menu for the overflowed items if overflow mode
        if overflowmode:
            self.overflowmenu   = SimpleMenu(self,self.menuskin)
            self.overflowbutton = UberButton(self, skin=self.buttonskin,type='menu',menu=self.overflowmenu)
            self.content.Add( (self.padding.x, 1), 1, EXPAND )
            self.content.Add(self.overflowbutton,0, RIGHT | EXPAND, self.padding.x)
            self.staticchildren.append(self.overflowbutton)
        else:
            spacersizer = self.spacersizer = wx.BoxSizer(wx.HORIZONTAL)
            spacersizer.Add((self.padding.x, 1),0,EXPAND)
            self.content.Add(spacersizer, 0, EXPAND )

        self.GenWidthRestriction()
Example #8
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.contentSizer = wx.BoxSizer(wx.VERTICAL)
        self.Sizer.Add(self.contentSizer, 1, wx.EXPAND|wx.ALL, 1)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #9
0
    def __init__(self, parent, excpetionlist):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.Font = default_font()

        self.exceptionlist = excpetionlist
        self.MinSize = (-1, self.Font.Height + 10 + self.Font.Descent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #10
0
    def __init__(self,
                 parent,
                 content=None,
                 title='',
                 buttonlabel='',
                 buttoncb=None,
                 titlemaker=None,
                 prefix=''):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        sizer = self.Sizer = BoxSizer(VERTICAL)
        self.headersizer = BoxSizer(HORIZONTAL)
        self.bodysizer = BoxSizer(VERTICAL)
        sizer.Add(self.headersizer, 0, EXPAND | TOP, space_over_header)
        sizer.Add(self.bodysizer, 1, EXPAND | TOP, space_under_header)

        self.title = None
        self.combo = None
        self.button = None
        self.content = None
        self.contents = {}
        self.titlemaker = titlemaker
        if wxMac:
            self.menuitems = {}

        if title and isinstance(title, basestring):
            self.title = wx.StaticText(self,
                                       -1,
                                       ' ' + title + ' ',
                                       style=wx.ALIGN_CENTER_VERTICAL)

            #need grey backgound behind label on mac to hide the line
            if wxMac:
                self.title.BackgroundColour = wx.Color(232, 232, 232)
            self.title.Font = self.HeaderFont
            self.headersizer.Add(self.title, 0, *header_sizer_flags)

        if callable(content):
            content = self.content = content(self, prefix)
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, wx.WindowClass):
            content.Reparent(self)
            self.content = content
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, list):
            self.SetContents(content)

        if buttoncb:
            self.SetButton(buttonlabel, buttoncb)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)

        #darker border if mac so it is visible for now
        if not wxMac:
            self.pen = wx.Pen(wx.Colour(213, 213, 213))
        else:
            self.pen = wx.Pen(wx.Colour(155, 155, 155))
Example #11
0
    def __init__(self, parent, label = '', collapsedicon = None, expandedicon = None):
        SimplePanel.__init__(self, parent)

        self.construct(label, collapsedicon, expandedicon)
        self.layout()
        self.bind_events()
        self.ToggleContents()

        self.Label = "chevron panel"
Example #12
0
    def __init__(self, parent, id = wx.ID_ANY, skinkey = None, name = 'ToolBar', alignment = None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.children = []

        self.content = wx.BoxSizer(wx.HORIZONTAL)
        self.Sizer = Margins().Sizer(self.content)

        self.SetSkinKey(skinkey, ToolBarSkinDefaults)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #13
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent)

        self.OnEditEmail = Delegate()
        self.OnSendEmail = Delegate()

        self.gui_constructed = False

        self.UpdateSkin()

        self.construct_gui()
Example #14
0
    def __init__(self, parent, skinkey):
        SimplePanel.__init__(self, parent)

        self.tabs = []  # a list of all the tabs
        self.rows = []  # a list of all the visible row, each a list of all the tabs in that row
        self.rowindex = 0  # the first visible row
        self.tabindex = 0  # the first tab of the first visible row
        self.tabendex = 0  # the last tab of the last visible row

        events = [
            (wx.EVT_PAINT, self.OnPaint),
            (wx.EVT_SIZE, self.OnSize),
            (wx.EVT_BUTTON, self.OnButton),
            (wx.EVT_MOUSEWHEEL, self.OnWheel),
            (wx.EVT_MOTION, self.OnMotion),
        ]

        for event, method in events:
            self.Bind(event, method)

        self.flagedrows = set()
        self.lastsize = self.Size

        self.rowheight = 0  # height of a row in pixels

        self.SetSkinKey(skinkey, True)

        # buttons for verticle alignment
        self.cupb = UberButton(self, CUPID, skin=self.scrollbuttonskin, icon=self.upicon)
        self.cupb.Show(False)

        self.cdownb = UberButton(self, CDOWNID, skin=self.scrollbuttonskin, icon=self.downicon)
        self.cdownb.Show(False)

        # the navigation box
        self.navi = Navi(self)

        self.dragorigin = None  # when draging the tab that you are dragging
        self.dragtarget = None  # when dragging the mouse is over and at that point released on

        # the arrow image shown when dragging tabs
        self.dropmarker = OverlayImage(self, self.dropmarkerimage)

        # self.dropmarker = Storage(Show = lambda v=True: None)
        self.dragside = None  # was the tab droped on the left or right of the target tab

        # linking prefs
        link = profile.prefs.link  # @UndefinedVariable
        link("tabs.rows", self.Generate, False)
        link("tabs.tabbar_x", self.Generate, False)
        link("tabs.hide_at_1", self.Generate, False)
        link("tabs.side_tabs", self.SkinRedirect, False)

        self.Top.Bind(wx.EVT_MENU, self.OnMenuEvent)
Example #15
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent)

        self.OnEditEmail = Delegate()
        self.OnSendEmail = Delegate()


        self.gui_constructed = False

        self.UpdateSkin()

        self.construct_gui()
Example #16
0
    def __init__(self, parent, skinkey):
        SimplePanel.__init__(self, parent)

        self.tabs     = [] # a list of all the tabs
        self.rows     = [] # a list of all the visible row, each a list of all the tabs in that row
        self.rowindex = 0  # the first visible row
        self.tabindex = 0  # the first tab of the first visible row
        self.tabendex = 0  # the last tab of the last visible row

        events = [(wx.EVT_PAINT, self.OnPaint),
                  (wx.EVT_SIZE, self.OnSize),
                  (wx.EVT_BUTTON, self.OnButton),
                  (wx.EVT_MOUSEWHEEL, self.OnWheel),
                  (wx.EVT_MOTION,self.OnMotion)]

        for event, method in events: self.Bind(event, method)


        self.flagedrows = set()
        self.lastsize=self.Size

        self.rowheight=0#height of a row in pixels

        self.SetSkinKey(skinkey,True)

        #buttons for verticle alignment
        self.cupb = UberButton(self, CUPID, skin=self.scrollbuttonskin, icon=self.upicon)
        self.cupb.Show(False)

        self.cdownb = UberButton(self, CDOWNID, skin=self.scrollbuttonskin, icon=self.downicon)
        self.cdownb.Show(False)

        #the navigation box
        self.navi=Navi(self)


        self.dragorigin = None#when draging the tab that you are dragging
        self.dragtarget = None#when dragging the mouse is over and at that point released on

        # the arrow image shown when dragging tabs
        self.dropmarker=OverlayImage(self, self.dropmarkerimage)

        # self.dropmarker = Storage(Show = lambda v=True: None)
        self.dragside=None#was the tab droped on the left or right of the target tab

        #linking prefs
        link = profile.prefs.link #@UndefinedVariable
        link('tabs.rows',      self.Generate, False)
        link('tabs.tabbar_x',  self.Generate, False)
        link('tabs.hide_at_1', self.Generate, False)
        link('tabs.side_tabs', self.SkinRedirect, False)

        self.Top.Bind(wx.EVT_MENU, self.OnMenuEvent)
Example #17
0
    def __init__(self,
                 parent,
                 label='',
                 collapsedicon=None,
                 expandedicon=None):
        SimplePanel.__init__(self, parent)

        self.construct(label, collapsedicon, expandedicon)
        self.layout()
        self.bind_events()
        self.ToggleContents()

        self.Label = "chevron panel"
Example #18
0
    def __init__(self, parent):
        """
            This is the header for the infobox used when displaying Email or
            Social networks.  Shows the account name and a number of related
            links.
        """

        SimplePanel.__init__(self, parent)
        self.account = None
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.linkage = PseudoSizer()
        self.extralinkage = None
        self.UpdateSkin()
Example #19
0
    def __init__( self, parent = None ):
        SimplePanel.__init__(self, parent)
        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        link = profile.prefs.link #@UndefinedVariable

        # setup and layout GUI
        self.tray_icons = []
        self.gui_construct()
        rebuild = self.rebuild_panels
        rebuild()

        # Watch always on top changes
        def ontop_changed(val):
            docker = wx.GetTopLevelParent(self).docker
            if docker.docked and docker.AutoHide:
                return

            p = wx.GetTopLevelParent(self)
            if val: p.WindowStyle = p.WindowStyle | wx.STAY_ON_TOP
            else:   p.WindowStyle = p.WindowStyle & ~wx.STAY_ON_TOP

        self.unlinkers = [link(*a) for a in [
            ('buddylist.always_on_top', ontop_changed, True, self),
            ('buddylist.order', lambda v: self.gui_layout(), False, self),
            ('buddylist.show_status', rebuild, False),
            ('buddylist.show_email_as', rebuild, False),
            ('buddylist.show_social_as', rebuild, False),
            ('buddylist.show_menubar', lambda v: self.gui_layout(), False, self),
            ('social.display_attr', rebuild, False),
            ('email.display_attr', rebuild, False),
            ('buddylist.show_in_taskbar', lambda val: wx.CallAfter(lambda: setattr(self.Top, 'OnTaskbar', val)), True, self)
        ]]

        # link docking preferences
        link = profile.localprefs.link
        docker = wx.GetTopLevelParent(self).docker

        self.unlinkers += [link(*a) for a in [
            ('buddylist.dock.autohide', lambda v: docker.SetAutoHide(bool(v)), True, docker),
            ('buddylist.dock.enabled',  lambda v: docker.SetEnabled(bool(v)), True, docker),
            ('buddylist.dock.revealms', lambda v: setattr(docker, 'RevealDurationMs', try_this(lambda: int(v), 300)), True, docker),
        ]]

        self.unlinkers.append(profile.prefs.link('buddylist.dock.slide_velocity', lambda v: wx.CallAfter(docker.SetVelocity,int(v)), obj = docker)) #@UndefinedVariable
        self.unlinkers.append(Storage(unlink = profile.emailaccounts.add_list_observer (rebuild, rebuild, 'enabled').disconnect))
        self.unlinkers.append(Storage(unlink = profile.socialaccounts.add_list_observer(rebuild, rebuild, 'enabled').disconnect))

        # don't ever let this control take focus
        self.Bind(wx.EVT_SET_FOCUS, lambda e:self.blist.SetFocus())
Example #20
0
    def __init__(self, parent):
        """
            This is the header for the infobox used when displaying Email or
            Social networks.  Shows the account name and a number of related
            links.
        """

        SimplePanel.__init__(self, parent)
        self.account=None
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.linkage = PseudoSizer()
        self.extralinkage = None
        self.UpdateSkin()
    def __init__(self, parent, bitmap, prefdict):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.prefdict = prefdict
        self.bitmap = bitmap
        self.MinSize = self.bitmap.Size + (16, 16)

        self.selected = False

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_MOTION, lambda e: self.Refresh())
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
Example #22
0
    def __init__(self, parent, bitmap, prefdict):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.prefdict = prefdict
        self.bitmap = bitmap
        self.MinSize = self.bitmap.Size + (16, 16)

        self.selected = False

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_MOTION, lambda e: self.Refresh())
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
Example #23
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 skinkey=None,
                 name='ToolBar',
                 alignment=None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.children = []

        self.content = wx.BoxSizer(wx.HORIZONTAL)
        self.Sizer = Margins().Sizer(self.content)

        self.SetSkinKey(skinkey, ToolBarSkinDefaults)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #24
0
    def __init__(self, parent, content=None, title='', buttonlabel='', buttoncb=None, titlemaker=None, prefix=''):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        sizer = self.Sizer = BoxSizer(VERTICAL)
        self.headersizer = BoxSizer(HORIZONTAL)
        self.bodysizer = BoxSizer(VERTICAL)
        sizer.Add(self.headersizer, 0, EXPAND | TOP, space_over_header)
        sizer.Add(self.bodysizer, 1, EXPAND | TOP, space_under_header)

        self.title      = None
        self.combo      = None
        self.button     = None
        self.content    = None
        self.contents   = {}
        self.titlemaker = titlemaker
        if wxMac:
            self.menuitems = {}

        if title and isinstance(title, basestring):
            self.title = wx.StaticText(self, -1, ' ' + title + ' ', style = wx.ALIGN_CENTER_VERTICAL)

            #need grey backgound behind label on mac to hide the line
            if wxMac:
                self.title.BackgroundColour=wx.Color(232,232,232)
            self.title.Font = self.HeaderFont
            self.headersizer.Add(self.title, 0, *header_sizer_flags)

        if callable(content):
            content = self.content = content(self, prefix)
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, wx.WindowClass):
            content.Reparent(self)
            self.content = content
            self.bodysizer.Add(self.content, 1, pref_sizer_style, 7)
        elif isinstance(content, list):
            self.SetContents(content)

        if buttoncb:
            self.SetButton(buttonlabel, buttoncb)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)

        #darker border if mac so it is visible for now
        if not wxMac:
            self.pen = wx.Pen(wx.Colour(213,213,213))
        else:
            self.pen = wx.Pen(wx.Colour(155,155,155))
Example #25
0
    def __init__(self, parent, account):

        self.initover = False

        SimplePanel.__init__(self, parent)

        self.Show(False)

        self.account = account

        #Refernce for the timer for delayed hide
        self.willhide = None

        self.SetSkinKey('AccountPanels', True)

        self.title = account.username

        self.account.add_observer(self.WhenStateChange, 'offline_reason')
        self.account.add_observer_callnow(self.WhenStateChange, 'state')

        #Becasue the width affects the content and the content effects the height
        #   this is used to store the last size so the widths can be compared
        #   perventing an infinit loop of size adjustments
        self.lastsizedto = self.Size

        #These are used for faking a button
        self.buttonstate = 0  #visual state: Idle; 1: hover; 2: down
        self.buttonisdown = False  #because if the button is down and shown down can differ
        self.buttonshown = False  #Is the button visible?

        self.linkhovered = False  #True if mouse is in the link rect
        self.linkdown = False  #True if the mouse button was pushed while in link rect

        Bind = self.Bind

        Bind(wx.EVT_PAINT, self.OnPaint)
        Bind(wx.EVT_SIZE, self.OnSize)
        Bind(wx.EVT_ENTER_WINDOW, self.OnMouseIn)
        Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseOut)
        Bind(wx.EVT_MOTION, self.OnMouseMotion)
        Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        Bind(wx.EVT_RIGHT_UP, self.OnMenu)
        Bind(wx.EVT_KEY_DOWN, self.OnKey)

        self.initover = True
Example #26
0
    def __init__(self, parent, account):

        self.initover = False

        SimplePanel.__init__(self, parent)

        self.Show(False)

        self.account=account

        #Refernce for the timer for delayed hide
        self.willhide = None

        self.SetSkinKey('AccountPanels',True)

        self.title = account.username

        self.account.add_observer(self.WhenStateChange,'offline_reason')
        self.account.add_observer_callnow(self.WhenStateChange,'state')

        #Becasue the width affects the content and the content effects the height
        #   this is used to store the last size so the widths can be compared
        #   perventing an infinit loop of size adjustments
        self.lastsizedto=self.Size

        #These are used for faking a button
        self.buttonstate = 0 #visual state: Idle; 1: hover; 2: down
        self.buttonisdown = False #because if the button is down and shown down can differ
        self.buttonshown= False #Is the button visible?

        self.linkhovered = False #True if mouse is in the link rect
        self.linkdown = False #True if the mouse button was pushed while in link rect

        Bind = self.Bind

        Bind(wx.EVT_PAINT,        self.OnPaint)
        Bind(wx.EVT_SIZE,         self.OnSize)
        Bind(wx.EVT_ENTER_WINDOW, self.OnMouseIn)
        Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseOut)
        Bind(wx.EVT_MOTION,       self.OnMouseMotion)
        Bind(wx.EVT_LEFT_DOWN,    self.OnLeftDown)
        Bind(wx.EVT_LEFT_UP,      self.OnLeftUp)
        Bind(wx.EVT_RIGHT_UP,     self.OnMenu)
        Bind(wx.EVT_KEY_DOWN,     self.OnKey)

        self.initover = True
Example #27
0
    def __init__(self, parent, panel, skinkey):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.SetSkinKey(skinkey, True)
        if not panel.Parent is self:
            panel.Reparent(self)

        self.panel = panel

        sizer = self.Sizer = wx.GridBagSizer()
        sizer.SetEmptyCellSize(wx.Size(0,0))
        sizer.Add(panel,(1,1),flag = wx.EXPAND)
        sizer.Add(wx.Size(self.framesize.left,  self.framesize.top),    (0,0))
        sizer.Add(wx.Size(self.framesize.right, self.framesize.bottom), (2,2))

        sizer.AddGrowableCol(1,1)
        sizer.AddGrowableRow(1,1)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #28
0
    def __init__(self, parent, panel, skinkey):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.SetSkinKey(skinkey, True)
        if not panel.Parent is self:
            panel.Reparent(self)

        self.panel = panel

        sizer = self.Sizer = wx.GridBagSizer()
        sizer.SetEmptyCellSize(wx.Size(0, 0))
        sizer.Add(panel, (1, 1), flag=wx.EXPAND)
        sizer.Add(wx.Size(self.framesize.left, self.framesize.top), (0, 0))
        sizer.Add(wx.Size(self.framesize.right, self.framesize.bottom), (2, 2))

        sizer.AddGrowableCol(1, 1)
        sizer.AddGrowableRow(1, 1)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
Example #29
0
    def __init__(self,parent,label='',callapsedicon=None,expandedicon=None):
        SimplePanel.__init__(self,parent)

        self.callapsedicon = callapsedicon or skin.get('AppDefaults.icons.chevroncolapsed')
        self.expandedicon = expandedicon or skin.get('AppDefaults.icons.chevronexpanded')
        self.Label = label
        self._expanded = False

        self.CalcSize()

        self.isdown = False

        Bind = self.Bind
        Bind(wx.EVT_PAINT,self.OnPaint)
        Bind(wx.EVT_LEFT_DOWN,self.OnLeftDown)
        Bind(wx.EVT_LEFT_UP,self.OnLeftUp)
        Bind(wx.EVT_LEFT_DCLICK, self.OnDClick)
        Bind(wx.EVT_ENTER_WINDOW, self.OnMouseIn)
        Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseOut)
Example #30
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        s = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(s)

        self.list = NotifyView(self)

        s.AddSpacer((1, H))
        s.Add(self.list, 1, wx.EXPAND| wx.ALL & ~wx.TOP,1)

        self.Bind(wx.EVT_PAINT, self.__paint)

        f = self.Font
        f.SetWeight(wx.FONTWEIGHT_BOLD)
        if platformName == 'mac':
            f.SetPointSize(11)
        self.Font = f

        self.Bind(wx.EVT_MOUSEWHEEL, lambda e: self.SetFocus())
Example #31
0
    def __init__(self, parent, validator=None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.validator = validator

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        profile_type = wx.Panel(self)
        rs = profile_type.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton
        overrads = self.overrads = dict(
            NEWPROFILE=RADIO(profile_type,
                             ID_NEWPROFILE,
                             _("&New Profile"),
                             style=wx.RB_GROUP),
            IMPORTPROFILE=RADIO(
                profile_type, ID_IMPORTPROFILE,
                _("&Import an existing profile from the Digsby servers")))

        rs.Add(overrads["NEWPROFILE"], 0, ALL, 2)
        rs.Add(overrads["IMPORTPROFILE"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        login_info = wx.Panel(self)

        ps = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(login_info, -1, s)
        INPUT = lambda d, style=0, v=wx.DefaultValidator: wx.TextCtrl(
            login_info, -1, d, style=style, validator=v)

        digsby_username = self.digsby_username = INPUT('')
        digsby_password = self.digsby_password = INPUT('',
                                                       style=wx.TE_PASSWORD)

        ps.Add(TEXT(_("&Digsby Username:"******"Digsby &Password:"******"&Profile Name:")), 0,
                ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        aus.Add(profile_name, 0,
                ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        aus.Add(TEXT(_("&Profile Password:"******"&Re-Enter Password:"******"Profile Info"))
        self.login_info_panel = PrefPanel(self, login_info, _("Login Info"))
        self.login_info_panel.Show(False)

        sz.Add(PrefPanel(self, profile_type, _("Profile Type")), 0,
               EXPAND | ALL, 2)
        sz.Add(self.profile_info_panel, 0, EXPAND | ALL, 2)
        sz.Add(self.login_info_panel, 0, EXPAND | ALL, 2)

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)
        Bind(wx.EVT_TEXT, self.validate_form)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)

        self.validate_form()
Example #32
0
    def __init__(self, parent, validator=None):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)
        self.validator = validator

        if platformName != "mac":
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        profile_type = wx.Panel(self)
        rs = profile_type.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton
        overrads = self.overrads = dict(
            NEWPROFILE=RADIO(profile_type, ID_NEWPROFILE, _("&New Profile"), style=wx.RB_GROUP),
            IMPORTPROFILE=RADIO(
                profile_type, ID_IMPORTPROFILE, _("&Import an existing profile from the Digsby servers")
            ),
        )

        rs.Add(overrads["NEWPROFILE"], 0, ALL, 2)
        rs.Add(overrads["IMPORTPROFILE"], 0, ALL, 2)

        # -------------------------------------------------------------------------------
        login_info = wx.Panel(self)

        ps = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(login_info, -1, s)
        INPUT = lambda d, style=0, v=wx.DefaultValidator: wx.TextCtrl(login_info, -1, d, style=style, validator=v)

        digsby_username = self.digsby_username = INPUT("")
        digsby_password = self.digsby_password = INPUT("", style=wx.TE_PASSWORD)

        ps.Add(TEXT(_("&Digsby Username:"******"Digsby &Password:"******"")
        self.login_status_text.Hide()
        login_info.Sizer.Add(self.login_status_text, 0, wx.EXPAND | wx.ALL, 7)

        # -------------------------------------------------------------------------------

        profile_info = wx.Panel(self)
        aus = profile_info.Sizer = wx.FlexGridSizer(2, 2)

        aus = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(profile_info, -1, s)
        INPUT = lambda d, style=0, id=-1: wx.TextCtrl(profile_info, id, d, style=style)

        profile_name = self.profile_name = INPUT("")
        profile_password = self.profile_password = INPUT("", wx.TE_PASSWORD)
        reenter_password = self.profile_password_2 = INPUT("", wx.TE_PASSWORD)

        aus.Add(TEXT(_("&Profile Name:")), 0, ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        aus.Add(profile_name, 0, ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        aus.Add(TEXT(_("&Profile Password:"******"&Re-Enter Password:"******"NOTE: For security, your password is not saved anywhere. If you forget it, there is no way to decrypt the account information for that profile. You'll need to remove the profile, create a new one, and add your accounts back."
            )
        )
        password_note.SetForegroundColour(wx.RED)
        password_note.Wrap(356)

        profile_info.Sizer = wx.BoxSizer(VERTICAL)
        profile_info.Sizer.Add(aus, 0, EXPAND | ALL)
        profile_info.Sizer.Add(password_note, 0, EXPAND | ALL, 7)

        # -------------------------------------------------------------------------------

        self.profile_info_panel = PrefPanel(self, profile_info, _("Profile Info"))
        self.login_info_panel = PrefPanel(self, login_info, _("Login Info"))
        self.login_info_panel.Show(False)

        sz.Add(PrefPanel(self, profile_type, _("Profile Type")), 0, EXPAND | ALL, 2)
        sz.Add(self.profile_info_panel, 0, EXPAND | ALL, 2)
        sz.Add(self.login_info_panel, 0, EXPAND | ALL, 2)

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)
        Bind(wx.EVT_TEXT, self.validate_form)

        if platformName != "mac":
            Bind(wx.EVT_PAINT, self.OnPaint)

        self.validate_form()
Example #33
0
    def __init__(self,parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        self.BackgroundColour = wx.WHITE

        self.Sizer = wx.BoxSizer(HORIZONTAL)
        sz = wx.BoxSizer(HORIZONTAL)

        self.Sizer.Add(sz,1,EXPAND|ALL,3)

        leftcol = wx.BoxSizer(VERTICAL)

        acctcombo = self.acctcombo = UberCombo(self, value='',skinkey='AppDefaults.PrefCombo')
        acctcont = PrefPanel(self,acctcombo,_('Account'))


        leftcol.Add(acctcont,0,EXPAND|ALL,3)

        buddylist = self.buddylist = ListOBuddies(self)
        self.buddies_panel = buddycont = PrefPanel(self, buddylist, _('Buddy'))
        leftcol.Add(buddycont, 1, EXPAND | TOPLESS, 3)

        style = wx.NO_BORDER | CAL_SUNDAY_FIRST | CAL_SEQUENTIAL_MONTH_SELECTION | CAL_SHOW_HOLIDAYS
        cal = self.cal = CalendarCtrl(self, -1, wx.DateTime.Now(), wx.DefaultPosition, wx.DefaultSize, style)

        cal.SetForegroundColour(wx.Color(160, 160, 160))
        cal.SetHolidayColours(wx.BLACK, wx.WHITE)
        cal.SetHeaderColours(Color(160, 160, 160), Color(239, 239, 239))

        calcont = PrefPanel(self,cal,_('Date'))
        leftcol.Add(calcont, 0, EXPAND | TOPLESS, 3)

        sz.Add(leftcol, 0, EXPAND)

        viewpanel = wx.Panel(self)

        viewer = self.viewer = PastBrowserWebkitWindow(viewpanel)
#        viewer.SetMouseWheelZooms(True)
        finder = self.finder = FindBar(viewpanel,viewer)

        menu = UMenu(viewer)
        menu.AddItem(_('Copy'),  id = wx.ID_COPY,  callback = lambda *a: viewer.Copy())

        viewer.BindWheel(self)
        viewer.BindScrollWin(self)
        viewer.Bind(wx.EVT_CONTEXT_MENU,
                    lambda e: (menu.GetItemById(wx.ID_COPY).Enable(viewer.CanCopy()),
                               menu.PopupMenu(event = e)))

        viewer.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)
        finder.TextControl.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)

        nav  = BoxSizer(wx.HORIZONTAL)

        prev = self.prev = UberButton(viewpanel, label = '<-', skin = BUTTON_SKIN)
        next = self.next = UberButton(viewpanel, label = '->', skin = BUTTON_SKIN)

        datelabel = wx.StaticText(viewpanel, -1, style = wx.ALIGN_CENTER| wx.ST_NO_AUTORESIZE)
        datelabel.SetMinSize((140, -1))


        prev.Bind(wx.EVT_BUTTON, lambda e: self.Flip(-1))
        next.Bind(wx.EVT_BUTTON, lambda e: self.Flip( 1))

        nav.AddStretchSpacer(1)
        nav.AddMany([(prev, 0, wx.EXPAND | wx.ALIGN_CENTER),
                     (datelabel, 0, wx.EXPAND | wx.ALIGN_CENTER),
                     (next, 0, wx.EXPAND | wx.ALIGN_CENTER)])
        nav.AddStretchSpacer(1)


        viewpanel.Sizer = wx.BoxSizer(wx.VERTICAL)
        viewpanel.Sizer.AddMany([ (nav,    0, EXPAND),
                                  (viewer, 1, EXPAND),
                                  (finder, 0, EXPAND) ])

        sz.Add(PrefPanel(self, viewpanel, _('Conversation Log')), 1, EXPAND | ALL, 3)

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnPaint)

        def OnAcct(*a):
            '''
            Handle selection of a new account from the Account drop down
            '''
            if self.GroupChatsSelected():
                from collections import defaultdict
                self.groupchats = defaultdict(list)
                for g in GetGroupChats():
                    d = g['time']
                    key = DateTimeFromDMY(d.day, d.month-1, d.year)
                    self.groupchats[key].append(g)

                #dates = sorted((g['date'], g) for g in
                self.dates = sorted(self.groupchats.keys())
                UpdateCal()
                self.buddies_panel.SetTitle(_('Chats'))
            else:
                buddylist.SetList(GetBuddies(acctcombo.Value.id), BuddyRenderer())
                OnBuddy()
                self.buddies_panel.SetTitle(_('Buddy'))

        def OnBuddy(*a):
            '''
            Handels selection of a buddy from the buddy pannel
            '''

            if not self.GroupChatsSelected():
                self.dates = GetDates(buddylist.SelectedBuddy.dir)
                UpdateCal()
            else:
                ViewLogForFile(buddylist.SelectedItem['file'], do_aliases=False)

        def UpdateCal():
            '''
            Switches the date to the last date conversed with the selected budy
            '''
            self.next.Enable(True)
            self.prev.Enable(True)
            if self.dates:
                self.cal.Date = self.dates[-1]

            self.cal.Enable(True)
            OnCalChange()

        def OnCalChange(*a):
            '''
            Update the Calendar UI to a new date
            '''
            caldate = cal.Date

            currentyear   = caldate.GetYear()
            currentmonth  = caldate.GetMonth()
            relevantdates = frozenset(date.GetDay() for date in self.dates
                                      if date.GetYear() == currentyear and
                                      date.GetMonth() == currentmonth and date.GetDay())
            SetHoliday, SetAttr = cal.SetHoliday, cal.SetAttr

            for i in xrange(1, 32):
                if i in relevantdates:
                    SetHoliday(i)
                else:
                    SetAttr(i, CalendarDateAttr(Color(160,160,160)))


            OnDayChange()

        self.OnCalChange = OnCalChange

        def ViewLogForDay(date):
            '''
            Load the log file for the specified date for the currently selected buddy
            '''
            logpath = logpath_for_date(buddylist.SelectedBuddy, date)
            ViewLogForFile(logpath)

        def ViewLogForFile(logpath, do_aliases=True):
            '''
            Update the log viewer with the file specified
            '''
            with viewer.Frozen():
                viewer.SetPageSource(logpath.text('utf-8', 'replace'), logpath.url())
                viewer.RunScript('window.scroll(0, 0);')

                if do_aliases:
                    substitue_aliases()

                import hooks
                hooks.notify('digsby.statistics.logviewer.log_viewed')

        def substitue_aliases():
            '''
            Swap out buddy names with their allies
            '''
            import gui
            with open(gui.skin.resourcedir() / 'html' / 'jquery-1.3.2.js', 'rb') as f:
                viewer.RunScript(f.read())
            buddy = buddylist.SelectedBuddy
            aliases = IAliasProvider(profile())
            import simplejson as json
            names = set(json.loads(viewer.RunScript("var foo = []; $('.buddy').each(function(){foo.push($(this).html())}); JSON.stringify(foo);")))
            for name in names:
                alias = aliases.get_alias(name, buddy.service, buddy.protocol) or name
                viewer.RunScript(SUBHTML % (json.dumps(name), json.dumps(alias)))

        def OnDayChange(*a):
            '''
            Show the log for the day selected in the clander
            '''
            date = cal.Date
            self.date = date

            datelabel.SetLabel(date.FormatDate())

            if cal.GetAttr(date.GetDay()).IsHoliday():
                if self.GroupChatsSelected():
                    chats = sorted(self.groupchats[date], key=lambda g: g['time'], reverse=True)
                    buddylist.SetList(chats, GroupChatRenderer())
                    if chats:
                        ViewLogForFile(chats[0]['file'], do_aliases=False)
                else:
                    ViewLogForDay(date)
            else:
                year  = str(date.GetYear())
                month = date.GetMonth()
                month = wx.DateTime.GetMonthName(int(month))
                day   = str(date.GetDay())

                specific_day_string = _('{month}, {day}, {year}').format(month=month, day=day, year=year)

                if self.GroupChatsSelected():
                    msg = _("There are no chat logs for {specific_day_string}.").format(specific_day_string=specific_day_string)
                else:
                    msg = _("There are no chat logs for {specific_day_string} with {name}.").format(specific_day_string=specific_day_string, name=buddylist.SelectedBuddy.name)

                viewer.SetPageSource(msg, 'file:///C:/')

            viewer.SetFocus()


            wx.CallAfter(cal.Refresh)
        self.OnDayChange = OnDayChange

        acctcombo.SetCallbacks(value = OnAcct)
        buddylist.Bind(wx.EVT_LISTBOX, OnBuddy)

        cBind = cal.Bind
        cBind(EVT_CALENDAR_YEAR, OnCalChange)
        cBind(EVT_CALENDAR_MONTH, OnCalChange)
        cBind(EVT_CALENDAR_SEL_CHANGED, OnDayChange)

        acctcombo.SetItems(MakeAccountItems(), 0)
Example #34
0
 def Reparent(self,newparent):
     SimplePanel.Reparent(self,newparent)
Example #35
0
    def __init__(self, parent=None):
        SimplePanel.__init__(self, parent)
        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        link = profile.prefs.link  #@UndefinedVariable

        # setup and layout GUI
        self.tray_icons = []
        self.gui_construct()
        rebuild = self.rebuild_panels
        rebuild()

        # Watch always on top changes
        def ontop_changed(val):
            docker = wx.GetTopLevelParent(self).docker
            if docker.docked and docker.AutoHide:
                return

            p = wx.GetTopLevelParent(self)
            if val: p.WindowStyle = p.WindowStyle | wx.STAY_ON_TOP
            else: p.WindowStyle = p.WindowStyle & ~wx.STAY_ON_TOP

        self.unlinkers = [
            link(*a)
            for a in [(
                'buddylist.always_on_top', ontop_changed, True, self
            ), ('buddylist.order', lambda v: self.gui_layout(), False,
                self), ('buddylist.show_status', rebuild,
                        False), (
                            'buddylist.show_email_as', rebuild,
                            False), ('buddylist.show_social_as', rebuild,
                                     False),
                      ('buddylist.show_menubar', lambda v: self.gui_layout(),
                       False,
                       self), ('social.display_attr', rebuild,
                               False), ('email.display_attr', rebuild, False),
                      ('buddylist.show_in_taskbar',
                       lambda val: wx.CallAfter(lambda: setattr(
                           self.Top, 'OnTaskbar', val)), True, self)]
        ]

        # link docking preferences
        link = profile.localprefs.link
        docker = wx.GetTopLevelParent(self).docker

        self.unlinkers += [
            link(*a) for a in [
                ('buddylist.dock.autohide',
                 lambda v: docker.SetAutoHide(bool(v)), True, docker),
                ('buddylist.dock.enabled',
                 lambda v: docker.SetEnabled(bool(v)), True, docker),
                ('buddylist.dock.revealms', lambda v: setattr(
                    docker, 'RevealDurationMs', try_this(lambda: int(v), 300)),
                 True, docker),
            ]
        ]

        self.unlinkers.append(
            profile.prefs.link(
                'buddylist.dock.slide_velocity',
                lambda v: wx.CallAfter(docker.SetVelocity, int(v)),
                obj=docker))  #@UndefinedVariable
        self.unlinkers.append(
            Storage(unlink=profile.emailaccounts.add_list_observer(
                rebuild, rebuild, 'enabled').disconnect))
        self.unlinkers.append(
            Storage(unlink=profile.socialaccounts.add_list_observer(
                rebuild, rebuild, 'enabled').disconnect))

        # don't ever let this control take focus
        self.Bind(wx.EVT_SET_FOCUS, lambda e: self.blist.SetFocus())
Example #36
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        top = wx.BoxSizer(HORIZONTAL)

        radpanel = wx.Panel(self)
        rs = radpanel.Sizer = wx.BoxSizer(VERTICAL)

        RADIO = wx.RadioButton

        overrads = self.overrads = dict(
            NONPROX=RADIO(radpanel,
                          ID_NONPROX,
                          _("&No proxy"),
                          style=wx.RB_GROUP,
                          name='override'),
            SYSPROX=RADIO(radpanel,
                          ID_SYSPROX,
                          _("Use &default system settings"),
                          name='override'),
            SETPROX=RADIO(radpanel,
                          ID_SETPROX,
                          _("&Specify proxy settings"),
                          name='override'))

        rs.Add(overrads["NONPROX"], 0, ALL, 2)
        rs.Add(overrads["SYSPROX"], 0, ALL, 2)
        rs.Add(overrads["SETPROX"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        proxyp = wx.Panel(self)
        ps = proxyp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(proxyp, -1, s)
        INPUT = lambda d, v=wx.DefaultValidator: wx.TextCtrl(
            proxyp, -1, d, validator=v)

        hosti = self.hosti = INPUT('')
        porti = self.porti = INPUT('', NumericLimit(65535))

        ps.Add(TEXT(_("&Host:")), 0, ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL,
               2)
        ps.Add(hosti, 0, ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        ps.Add(TEXT(_("P&ort:")), 0, ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL,
               2)
        ps.Add(porti, 0, ALIGN_LEFT | ALIGN_CENTER_VERTICAL | ALL, 2)
        ps.AddGrowableCol(1, 1)
        #-------------------------------------------------------------------------------
        protop = wx.Panel(self)
        prs = protop.Sizer = wx.BoxSizer(VERTICAL)

        protorads = self.protorads = dict(
            HTTP=RADIO(protop,
                       ID_HTTP,
                       "&HTTP",
                       style=wx.RB_GROUP,
                       name='proxytype'),
            #HTTPS  = RADIO(protop, ID_HTTPS, "HTTPS", name = 'proxytype'),
            SOCKS4=RADIO(protop, ID_SOCKS4, "SOCKS &4", name='proxytype'),
            SOCKS5=RADIO(protop, ID_SOCKS5, "SOCKS &5", name='proxytype'))

        prs.Add(protorads["HTTP"], 0, ALL, 2)
        #prs.Add(protorads["HTTPS"], 0, ALL, 2)
        prs.Add(protorads["SOCKS4"], 0, ALL, 2)
        prs.Add(protorads["SOCKS5"], 0, ALL, 2)

        #-------------------------------------------------------------------------------
        authp = wx.Panel(self)
        aus = authp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(authp, -1, s)
        INPUT = lambda d, style=0: wx.TextCtrl(authp, -1, d, style=style)

        aus.Add(TEXT(_("&Username:"******"&Password:"******"Proxy Server")), 1, EXPAND | ALL, 2)
        top.Add(PrefPanel(self, protop, _("Protocol")), 0, EXPAND | ALL, 2)

        sz.Add(PrefPanel(self, radpanel, _("How to Connect")), 0, EXPAND | ALL,
               2)
        sz.Add(top, 1, EXPAND)
        sz.Add(PrefPanel(self, authp, _("Authentication")), 1, EXPAND | ALL, 2)

        pd = self.proxy_dict

        override = pd.get('override', "SYSPROX")

        try:
            override = int(override)
        except:
            pass
        else:
            override = ['SYSPROX', 'SETPROX'][override]

        self.override = override
        self.overrads[self.override].Value = True

        self.addr = pd.get('addr', '')
        self.port = pd.get('port', '')

        self.proxytype = pd.get('proxytype', 'HTTP')
        self.protorads[self.proxytype].Value = True

        self.username = pd.get('username', '')
        self.password = pd.get('password', '')

        self.Enablement()

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)
Example #37
0
 def __init__(self, parent):
     SimplePanel.__init__(self, parent)
     self.SetSizer(BoxSizer(VERTICAL))
     self.Bind(wx.EVT_SIZE, self.OnSize)
     self._active = None
Example #38
0
    def __init__(self, parent):
        SimplePanel.__init__(self, parent, wx.FULL_REPAINT_ON_RESIZE)

        if platformName != 'mac':
            self.BackgroundColour = WHITE

        sz = self.Sizer = wx.BoxSizer(VERTICAL)

        top = wx.BoxSizer(HORIZONTAL)


        radpanel = wx.Panel(self)
        rs = radpanel.Sizer = wx.BoxSizer(VERTICAL)


        RADIO = wx.RadioButton

        overrads = self.overrads = dict(NONPROX = RADIO(radpanel, ID_NONPROX, _("&No proxy"), style = wx.RB_GROUP, name = 'override'),
                                        SYSPROX = RADIO(radpanel, ID_SYSPROX, _("Use &default system settings"), name = 'override'),
                                        SETPROX = RADIO(radpanel, ID_SETPROX, _("&Specify proxy settings"), name = 'override'))


        rs.Add(overrads["NONPROX"], 0, ALL, 2)
        rs.Add(overrads["SYSPROX"], 0, ALL, 2)
        rs.Add(overrads["SETPROX"], 0, ALL, 2)

#-------------------------------------------------------------------------------
        proxyp = wx.Panel(self)
        ps = proxyp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(proxyp, -1, s)
        INPUT = lambda d, v = wx.DefaultValidator: wx.TextCtrl(proxyp, -1, d, validator = v)

        hosti = self.hosti = INPUT('')
        porti = self.porti = INPUT('', NumericLimit(65535))

        ps.Add(TEXT(_("&Host:")),
              0,
              ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        ps.Add(hosti,
              0,
              ALIGN_LEFT | ALIGN_CENTER_VERTICAL | EXPAND | ALL, 2)

        ps.Add(TEXT(_("P&ort:")),
              0,
              ALIGN_RIGHT | ALIGN_CENTER_VERTICAL | ALL, 2)
        ps.Add(porti,
              0,
              ALIGN_LEFT | ALIGN_CENTER_VERTICAL | ALL, 2)
        ps.AddGrowableCol(1, 1)
#-------------------------------------------------------------------------------
        protop = wx.Panel(self)
        prs = protop.Sizer = wx.BoxSizer(VERTICAL)

        protorads = self.protorads = dict(HTTP = RADIO(protop, ID_HTTP, "&HTTP", style = wx.RB_GROUP, name = 'proxytype'),
                                          #HTTPS  = RADIO(protop, ID_HTTPS, "HTTPS", name = 'proxytype'),
                                          SOCKS4 = RADIO(protop, ID_SOCKS4, "SOCKS &4", name = 'proxytype'),
                                          SOCKS5 = RADIO(protop, ID_SOCKS5, "SOCKS &5", name = 'proxytype')
                                          )

        prs.Add(protorads["HTTP"], 0, ALL, 2)
        #prs.Add(protorads["HTTPS"], 0, ALL, 2)
        prs.Add(protorads["SOCKS4"], 0, ALL, 2)
        prs.Add(protorads["SOCKS5"], 0, ALL, 2)


#-------------------------------------------------------------------------------
        authp = wx.Panel(self)
        aus = authp.Sizer = wx.FlexGridSizer(2, 2)

        TEXT = lambda s: wx.StaticText(authp, -1, s)
        INPUT = lambda d, style = 0: wx.TextCtrl(authp, -1, d, style = style)

        aus.Add(TEXT(_("&Username:"******"&Password:"******"Proxy Server")), 1, EXPAND | ALL, 2)
        top.Add(PrefPanel(self, protop, _("Protocol")), 0, EXPAND | ALL, 2)


        sz.Add(PrefPanel(self, radpanel, _("How to Connect")), 0, EXPAND | ALL, 2)
        sz.Add(top, 1, EXPAND)
        sz.Add(PrefPanel(self, authp, _("Authentication")), 1, EXPAND | ALL, 2)

        pd = self.proxy_dict

        override = pd.get('override', "SYSPROX")

        try:
            override = int(override)
        except:
            pass
        else:
            override = ['SYSPROX', 'SETPROX'][override]

        self.override = override
        self.overrads[self.override].Value = True

        self.addr = pd.get('addr', '')
        self.port = pd.get('port', '')

        self.proxytype = pd.get('proxytype', 'HTTP')
        self.protorads[self.proxytype].Value = True

        self.username = pd.get('username', '')
        self.password = pd.get('password', '')

        self.Enablement()

        Bind = self.Bind
        Bind(wx.EVT_RADIOBUTTON, self.OnRadio)

        if platformName != 'mac':
            Bind(wx.EVT_PAINT, self.OnPaint)
Example #39
0
    def __init__(self,
                 parent,
                 buddy_callback,
                 showCapabilities=True,
                 infoboxmode=False):
        SimplePanel.__init__(self, parent)

        self.buddy_callback = buddy_callback

        self.Bind(wx.EVT_PAINT, lambda e: wx.PaintDC(self))

        self.infoboxmode = infoboxmode
        self._lastcaps = None

        self.UpdateSkin()
        self.Sizer = wx.BoxSizer(wx.VERTICAL)

        # create delegates for callbacks
        for action in ('OnSendFiles', 'OnSendFolder', 'OnViewPastChats',
                       'OnAlert', 'OnBlock', 'OnAddContact'):
            setattr(self, action, Delegate())

        # Create the uberbar for the capabilities.
        self.cbar = bar = UberBar(self,
                                  skinkey=self.capabilitiesskin,
                                  overflowmode=True)
        # FIXME: we should simply not allow the capabilities bar to be created for native mode
        if not showCapabilities or nativeIMWindow:
            self.cbar.Hide()

        if not infoboxmode:
            self.cbar.Bind(wx.EVT_CONTEXT_MENU,
                           lambda e: self.ActionsBarMenu.PopupMenu(event=e))

        # Create all the buttons for the capabilities bar.

        iconsize = skin.get('ActionsBar.IconSize')
        icons = skin.get('ActionsBar.Icons')

        for attr, title, tooltip in buttons:
            icon = getattr(icons, attr).Resized(iconsize)
            if attr == 'files':
                # "files" has a dropdown menu
                button = UberButton(bar,
                                    -1,
                                    title,
                                    icon=icon,
                                    type='menu',
                                    menu=self.FileMenu)

                # Change the label and action of the files button when it's overflowed into
                # the menu on the right.
                button.overflow_label = _('Send File')
                button.overflow_callback = self.OnSendFiles
            else:
                # hack until I fix this :[ -kevin
                if attr == 'video' and infoboxmode: continue

                button = UberButton(bar, -1, title, icon=icon)
                button.overflow_label = title

            button.SetToolTipString(tooltip)

            setattr(self, 'b' + attr, button)
            bar.Add(button, calcSize=False)

        bar.OnUBSize()

        #TODO Add button logics

        #        if not self.infoboxmode:
        #            self.badd = UberButton(bar,-1,'',icon = getattr(icons, 'add').Resized(iconsize))
        #            bar.AddStatic(self.badd)
        #            self.badd.Bind(wx.EVT_BUTTON,lambda e: self.OnAddContact())

        # Create multichat icon for the roomlist
        if pref('messaging.groupchat.enabled', False) and not self.infoboxmode:
            self.bmultichat = UberButton(
                bar,
                -1,
                icon=skin.get('actionsbar.icons.roomlist').Resized(16),
                type='toggle')
            self.bmultichat.SetToolTipString(_('Group Chat'))
            bar.AddStatic(self.bmultichat)

        self.ihistory = SimpleMenuItem(_('View Past Chats'),
                                       method=self.OnViewPastChats)

        def show_prefs_notifications(a):
            import gui.pref.prefsdialog as prefsdialog
            prefsdialog.show('notifications')

        self.ialert = SimpleMenuItem(_("Alert Me When..."),
                                     method=show_prefs_notifications)
        self.iblock = SimpleMenuItem(_("Block"), method=self.OnBlock)

        if not self.infoboxmode:
            self.iadd = SimpleMenuItem(_("Add Contact"),
                                       method=self.OnAddContact)
            bar.AddMenuItem(self.iadd)
        bar.AddMenuItem(self.ihistory)
        bar.AddMenuItem(self.ialert)

        if not self.infoboxmode:
            bar.AddMenuItem(SimpleMenuItem(id=-1))
            bar.AddMenuItem(self.iblock)

        self.Sizer.Add(bar, 0, wx.EXPAND)

        # create the To/From bar
        self.tfbar = tfbar = UberBar(self, skinkey=self.tofromskin)
        self.tfbar.Hide()

        tofrom_font = skin.get('tofrombar.font', default_font)
        tofrom_color = skin.get('tofrombar.fontcolor', wx.BLACK)

        talign = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT

        self.to_label = ClearText(tfbar, _('To:'), alignment=talign)
        self.to_label.Font = tofrom_font
        self.to_label.FontColor = tofrom_color
        self.from_label = ClearText(tfbar, _('From:'), alignment=talign)
        self.from_label.Font = tofrom_font
        self.from_label.FontColor = tofrom_color

        self.cto = UberCombo(tfbar,
                             skinkey=self.tofromcomboskin,
                             typeable=False,
                             size=(100, 20),
                             minmenuwidth=200)
        self.cfrom = UberCombo(tfbar,
                               skinkey=self.tofromcomboskin,
                               typeable=False,
                               size=(100, 20),
                               minmenuwidth=200)

        tfbar.Add(self.to_label, calcSize=False)
        tfbar.Add(self.cto, True, calcSize=False)
        tfbar.Add(self.from_label, calcSize=False)
        tfbar.Add(self.cfrom, True)

        self.Sizer.Add(tfbar, 0, wx.EXPAND)

        profile.prefs.link(action_icons_key, self.UpdateIcons)

        self.cbar.overflowmenu.BeforeDisplay += self.ApplyCaps
Example #40
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 skinkey=None,
                 overflowmode=False,
                 name='UberBar',
                 alignment=None):

        SimplePanel.__init__(self, parent, FULL_REPAINT_ON_RESIZE)
        UberWidget.__init__(self, 'toolbar')

        self.ChildPaints = Delegate()

        # Initing variables
        self.alignment = alignment if alignment and not overflowmode else ALIGN_LEFT
        self.overflowmode = overflowmode
        self.navimode = False
        self.active = None
        self.children = []
        self.staticchildren = []
        self.overflowed = []
        self.focus = None
        self.lastheight = 0

        Bind = self.Bind
        Bind(wx.EVT_PAINT, self.OnBGPaint)
        Bind(wx.EVT_SIZE, self.OnReSize)

        self.keyletters = {}

        self.tlmargins = Size()
        self.brmargins = Size()

        #Start setting up an alternaitve Native Menubar for native mode

        self.SetSkinKey(skinkey, True)

        self.content = wx.BoxSizer(HORIZONTAL)
        sizer = self.Sizer = wx.GridBagSizer()
        sizer.SetEmptyCellSize(wx.Size(0, 0))

        contentFlag = TOP | BOTTOM | (self.alignment | EXPAND if self.alignment
                                      == ALIGN_LEFT else self.alignment)

        sizer.Add(self.content, (1, 1),
                  flag=contentFlag,
                  border=self.padding.y)
        sizer.Add(Size(self.margins.left, self.margins.top), (0, 0))
        sizer.Add(Size(self.margins.right, self.margins.bottom), (2, 2))
        sizer.AddGrowableCol(1, 1)
        sizer.AddGrowableRow(1, 1)
        #

        #Set up the menu for the overflowed items if overflow mode
        if overflowmode:
            self.overflowmenu = SimpleMenu(self, self.menuskin)
            self.overflowbutton = UberButton(self,
                                             skin=self.buttonskin,
                                             type='menu',
                                             menu=self.overflowmenu)
            self.content.Add((self.padding.x, 1), 1, EXPAND)
            self.content.Add(self.overflowbutton, 0, RIGHT | EXPAND,
                             self.padding.x)
            self.staticchildren.append(self.overflowbutton)
        else:
            spacersizer = self.spacersizer = wx.BoxSizer(wx.HORIZONTAL)
            spacersizer.Add((self.padding.x, 1), 0, EXPAND)
            self.content.Add(spacersizer, 0, EXPAND)

        self.GenWidthRestriction()
Example #41
0
 def __init__(self, parent):
     SimplePanel.__init__(self, parent)
     self.SetSizer(BoxSizer(VERTICAL))
     self.Bind(wx.EVT_SIZE, self.OnSize)
     self._active = None