Beispiel #1
0
    def found_terminator(self):
        '''
        Invoked by asynchat when either the end of a packet header has
        been reached, or when the end of packet data has been reached.
        '''
        datastr = ''.join(self.data)

        # Flip between receive header/data...
        # either the entire header has just arrived
        if self.getting_header:
            self.getting_header = False

            self.header = to_storage(
                unpack_named(*(header_desc + tuple([datastr]))))
            if self.header.ymsg != 'YMSG' or self.header.size < 0:
                return log.warning('invalid packet')

            if self.header.size > 0:
                # Tell asynchat to read _size_ more bytes of data.
                self.set_terminator(self.header.size)
            else:
                # In this case, there is no data--handle the packet now.
                self.getting_header = True
                self.set_terminator(header_size)
                self.handle_packet(self.header, datastr)
                self.data = []

        # or else we just got the rest of the packet
        else:
            self.getting_header = True
            self.set_terminator(header_size)
            self.handle_packet(self.header, datastr[header_size:])
            self.data = []
Beispiel #2
0
    def found_terminator(self):
        '''
        Invoked by asynchat when either the end of a packet header has
        been reached, or when the end of packet data has been reached.
        '''
        datastr = ''.join(self.data)

        # Flip between receive header/data...
        # either the entire header has just arrived
        if self.getting_header:
            self.getting_header = False

            self.header = to_storage(unpack_named(
                                      *(header_desc + tuple([datastr]))))
            if self.header.ymsg != 'YMSG' or self.header.size < 0:
                return log.warning('invalid packet')

            if self.header.size > 0:
                # Tell asynchat to read _size_ more bytes of data.
                self.set_terminator(self.header.size)
            else:
                # In this case, there is no data--handle the packet now.
                self.getting_header = True
                self.set_terminator(header_size)
                self.handle_packet(self.header, datastr)
                self.data = []

        # or else we just got the rest of the packet
        else:
            self.getting_header = True
            self.set_terminator(header_size)
            self.handle_packet(self.header, datastr[header_size:])
            self.data = []
Beispiel #3
0
def csd_to_storage(str):
    '''
    turn mime headers into a storage object
    '''
    info = csd_to_dict(str)
    for k in info.keys():
        info[util.pythonize(k)] = info.pop(k)

    return util.to_storage(info)
Beispiel #4
0
def csd_to_storage(str):
    '''
    turn mime headers into a storage object
    '''
    info = csd_to_dict(str)
    for k in info.keys():
        info[pythonize(k)] = info.pop(k)

    return to_storage(info)
Beispiel #5
0
def get_SI2_anchor(image):
    retval = to_storage({})
    if hasattr(image.image_dictionary, 'offset'):
        retval['offset'] = image.image_dictionary.offset
    if hasattr(image.image_dictionary, 'valign'):
        retval['valign'] = image.image_dictionary.valign
    if hasattr(image.image_dictionary, 'halign'):
        retval['halign'] = image.image_dictionary.halign
    return retval
Beispiel #6
0
def get_SI2_anchor(image):
    retval = to_storage({})
    if hasattr(image.image_dictionary, 'offset'):
        retval['offset'] = image.image_dictionary.offset
    if hasattr(image.image_dictionary, 'valign'):
        retval['valign'] = image.image_dictionary.valign
    if hasattr(image.image_dictionary, 'halign'):
        retval['halign'] = image.image_dictionary.halign
    return retval
Beispiel #7
0
def mime_to_storage(str):
    '''
    turn mime headers into a storage object
    '''
    info = mime_to_dict(str)
    for k in info.keys():
        info[pythonize(k)] = info[k]

    return to_storage(info)
Beispiel #8
0
def from_mime(mime_info, email, msn, friendlyname=None):
    '''
    from_mime(mime_info, email, msn, friendlyname=None)
    Update a buddy from a MIME profile packet.

    @param mime_info:    the mime header dictionary
    @param email:        thier email address
    @param msn:          msn to add them to
    @param friendlyname: thier friendlyname, defaults to None
    '''

    b = msn.get_buddy(email)
    if friendlyname:
        b.remote_alias = friendlyname.decode('url').decode('fuzzy utf8') or None
        assert isinstance(b.remote_alias, unicode)
    info = to_storage(mime_info)
    for k, v in info.items():
        k = k.replace(" ", "_").replace("-", "_").lower()
        setattr(b, k, v)

    b.info = dict(info.items())

    return b
Beispiel #9
0
def from_lst(msn, N, **kwargs):
    '''
    from_lst(msn, **kwargs)

    create an MSNBuddy from a LST command, which are in the format:
        N=email
        C=guid
        F=friendlyname
        etc.

    @param msn:        the owner of the buddy object
    @param N:          required, because there is no way to update a buddy
                       without an email address.
    @param **kwargs:   more stuff to put in the buddy object.
    '''
    email = N
    kwargs = to_storage(kwargs)
    b = msn.get_buddy(email)
    if 'F' in kwargs:
        b.remote_alias = kwargs['F'].decode('url').decode('fuzzy utf8') or None
    if 'C' in kwargs:
        b.guid = msn.cid_class(kwargs['C'])

    return b
Beispiel #10
0
    def compute_rect(self, image, dcrect):
        # count anchors to
        myanchors = image.get_anchors_to()
        numanchors = len(myanchors)

        #if stretch/tile, assert 0 < numanchorsto < 3
        if image.style != 'static':
            if not (numanchors == 1 or numanchors == 2):
                raise AssertionError('%r is not static but has anchors %r' %
                                     (image, image.anchors))

            # if 1, use dc + image offset/align as other "to"
            # compute anchor position(self, DCsize, (0,0))
            # map 0,0 of self to that position
            if numanchors == 1:
                anchorfrom = to_storage(myanchors[0])
                tag = anchorfrom.to
                imageto = self.tags[tag]

                anchorto = to_storage([
                    anchor for anchor in imageto.anchors
                    if anchor['tag'] == tag
                ][0])
                if imageto not in self.drawrects:
                    self.compute_rect(imageto, dcrect)

                rectto1 = self.drawrects[imageto]
                rectto2 = (0, 0, dcrect.width, dcrect.height)

                positionto1 = compute_anchor_position(anchorto, rectto1[2:],
                                                      rectto1[:2])
                positionto2 = compute_anchor_position(get_SI2_anchor(image),
                                                      rectto2[2:], rectto2[:2])

                #relative position (local anchors)
                positionfrom1 = compute_anchor_position(
                    anchorfrom, [image.width, image.height], [0, 0])
                positionfrom2 = (0, 0)
                diffxto = abs(positionto1[0] - positionto2[0])
                diffyto = abs(positionto1[1] - positionto2[1])
                diffxlocal = abs(positionfrom1[0] - positionfrom2[0])
                diffylocal = abs(positionfrom1[1] - positionfrom2[1])

                increasex = diffxto - diffxlocal
                increasey = diffyto - diffylocal

                newsizew = image.width + increasex
                newsizeh = image.height + increasey

                newlocalanchorposition = positionto2
                positiontodrawat = (positionfrom2[0] +
                                    newlocalanchorposition[0],
                                    positionfrom2[1] +
                                    newlocalanchorposition[1])
                #                print 'positiontodrawat1', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0],
                                         positiontodrawat[1], newsizew,
                                         newsizeh)
                #                print "self.drawrects[image]", self.drawrects[image]
                return
            #if 2, whatever
            elif numanchors == 2:
                #local anchors
                anchorfrom1, anchorfrom2 = myanchors
                tag1, tag2 = anchorfrom1['to'], anchorfrom2['to']
                imageto1, imageto2 = self.tags[tag1], self.tags[tag2]
                #remote anchors
                anchorto1 = [
                    anchor for anchor in imageto1.get_anchors_to()
                    if anchor['tag'] == tag1
                ]
                anchorto2 = [
                    anchor for anchor in imageto2.get_anchors_to()
                    if anchor['tag'] == tag2
                ]

                if imageto1 not in self.drawrects:
                    self.compute_rect(imageto1, dcrect)
                if imageto2 not in self.drawrects:
                    self.compute_rect(imageto2, dcrect)
                rectto1 = self.drawrects[imageto1]
                rectto2 = self.drawrects[imageto2]
                #absolute position (remote anchors)
                positionto1 = compute_anchor_position(anchorto1, rectto1[2:],
                                                      rectto1[:2])
                positionto2 = compute_anchor_position(anchorto2, rectto2[2:],
                                                      rectto2[:2])

                #relative position (local anchors)
                positionfrom1 = compute_anchor_position(
                    anchorfrom1, [image.imgw, image.imgh], [0, 0])
                positionfrom2 = compute_anchor_position(
                    anchorfrom2, [image.imgw, image.imgh], [0, 0])
                #CAS: check relative positioning here

                diffxto = abs(positionto1[0] - positionto2[0])
                diffyto = abs(positionto1[1] - positionto2[1])
                diffxlocal = abs(positionfrom1[0] - positionfrom2[0])
                diffylocal = abs(positionfrom1[1] - positionfrom2[1])

                increasex = diffxto - diffxlocal
                increasey = diffyto - diffylocal

                newsizew = image.imgw + increasex
                newsizeh = image.imgh + increasey
                #compute new position of one local anchor on new size
                newlocalanchorposition = compute_anchor_position(
                    anchorfrom1, newsizew, newsizeh, [0, 0])
                #subtract from position of remote anchor to find the absolute position of this image

                positiontodrawat = (positionto1[0] - newlocalanchorposition[0],
                                    positionto1[1] - newlocalanchorposition[1])
                #                print 'positiontodrawat2', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0],
                                         positiontodrawat[1], newsizew,
                                         newsizeh)
                return
            else:
                raise AssertionError(
                    "invalid skin, wrong number"
                    " (%d) of anchors for "
                    "image of type %s!" %
                    (numanchors, image.image_dictionary['style']))
        #else assert -1 < numanchors < 2
        else:
            assert (numanchors == 0 or numanchors == 1)
            #if 0, use dc + image offset/align as "to"
            #compute anchor position(self, DCsize, (0,0))
            #draw at that position
            #print numanchors, image
            if numanchors == 0:
                #                print "image", image
                #                print dir(image)
                #                print "anchor", get_SI2_anchor(image)

                positiontodrawat = compute_anchor_position(
                    get_SI2_anchor(image), (dcrect.width, dcrect.height),
                    [0, 0])
                #                print 'positiontodrawat3', positiontodrawat
                #rect = our offset and size
                #print "adding", image.image_dictionary, "to drawrects"
                self.drawrects[image] = (positiontodrawat[0],
                                         positiontodrawat[1], image.width,
                                         image.height)
                #                print "self.drawrects[image]", self.drawrects[image]
                return
                #draw this image there
            #if 1, whatever
            elif numanchors == 1:
                anchorfrom = image.get_anchors_to()[0]
                tag = anchorfrom['to']
                imageto = self.tags[tag]
                anchorto = [
                    anchor for anchor in imageto.get_anchors_to()
                    if anchor['tag'] == tag
                ]
                if imageto not in self.drawrects:
                    self.compute_rect(imageto, dcrect)
                rectto = self.drawrects[imageto]
                #absolute position
                positionto = compute_anchor_position(anchorto, rectto[2:],
                                                     rectto[:2])
                #relative position
                positionfrom = compute_anchor_position(
                    anchorfrom, [image.width, image.height], [0, 0])
                positiontodrawat = (positionto[0] - positionfrom[0],
                                    positionto[1] - positionfrom[1])
                #                print 'positiontodrawat4', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0],
                                         positiontodrawat[1], image.width,
                                         image.height)
                return
            else:
                raise AssertionError(
                    "invalid skin, wrong number"
                    " (%d) of anchors for "
                    "image of type %s!" %
                    (numanchors, image.image_dictionary['style']))
Beispiel #11
0
        retval['halign'] = image.halign
    return retval


def main(images):
    temp_dc = wx.MemoryDC()
    temp_dc.SelectObject(destbitmap)
    mimg = MultiImage(images)
    drawrect = wx.Rect(10, 10, 220, 440)
    mimg.draw(temp_dc, drawrect)

    temp_dc.SelectObject(wx.NullBitmap)


if __name__ == '__main__':
    import util, syck
    from skins import images as imgmngr
    from skins import skins
    app = wx.PySimpleApp()

    #    image['source'] = 'skins/default/checkerboard9.png'
    skins.res_path = "../../res/"
    destbitmap = imgmngr.get('skins/default/blue-flower.jpg')
    f = file("../../res/skins/skinExample")

    images = to_storage(syck.load(f)).Images
    f.close()
    util.profile(main, images)
    destbitmap.SaveFile('C:/workspace/Digsby/res/skins/default/output.png',
                        wx.BITMAP_TYPE_PNG)
Beispiel #12
0
    def testSkinTransform(self):
        s = '''
button:
  font: {color: white}
  menuicon: dropmenuicon.png
  color: green
  border: {color: black, width: 0, style: solid}
  spacing: [5, 5]
  image:
    regions: {}
    source: buttonblue.png
    corners:
      side: all
      size: [3, 3]
    style: stretch
  down:
    color: dark green
    image:
      regions: {}
      source: buttonmagenta.png
      corners:
        side: all
        size: [3, 3]
      style: stretch
    border: {color: black, width: 0, style: solid}
    font: {color: black}
  over:
    color: light green
    image:
      regions: {}
      source: buttoncyan.png
      style: stretch
      corners:
        side: all
        size: [3, 3]
    font: {color: green}
    border: {color: black, width: 0, style: solid}
  active:
    color: dark green
    image:
      regions: {}
      source: buttonmagenta.png
      corners:
        side: all
        size: [3, 3]
      style: stretch
    over:
      color: light green
      image:
        regions: {}
        source: buttoncyan.png
        style: stretch
        corners:
          side: all
          size: [3, 3]
      font: {color: green}
      border: {color: black, width: 0, style: solid}
    border: {color: black, width: 0, style: solid}
    font: {color: black}
  disabled:
    color: grey
    image:
      regions: {}
      source: buttongrey.png
      style: stretch
      corners:
        side: all
        size: [3, 3]
    border: 1px black solid
    font: {color: light grey}
'''
        s = util.to_storage(yaml.load(s))
        ready_skin(s)
        print s
Beispiel #13
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Shaped Window",
                         style = wx.FRAME_SHAPED | wx.SIMPLE_BORDER |
                                 wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP )

        self.hasShape = False
        self.delta = (0,0)

        [self.Bind(e, m) for e,m in [
         (wx.EVT_LEFT_DCLICK,   self.OnDoubleClick),
         (wx.EVT_LEFT_DOWN,     self.OnLeftDown),
         (wx.EVT_LEFT_UP,       self.OnLeftUp),
         (wx.EVT_MOTION,        self.OnMouseMove),
         (wx.EVT_RIGHT_UP,      self.OnExit),
         (wx.EVT_PAINT,         self.OnPaint),
        ]]

        from skins import images as imgmngr
        from skins import skins

        f = file("../../res/skins/halloween/skin.yaml")
        images = util.to_storage(yaml.load(f)).Images
        f.close()

        skins.res_path = "../../res/skins/halloween"

        mimg = MultiImage(images)

        from gui.uberwidgets.UberBar import UberBar as UberBar
        from gui.uberwidgets.UberButton import UberButton as UberButton

        self.content = wx.Panel(self)

        innerSizer = wx.BoxSizer(wx.HORIZONTAL)


        self.bsizer = wx.BoxSizer(wx.VERTICAL)
        self.menu = UberBar(self.content)
        [self.menu.add(UberButton(self.menu, -1, s))
                       for s in 'Digsby Edit Help'.split()]

        self.bsizer.Add(self.menu, 0, wx.EXPAND, 0)
        self.content.SetSizer(self.bsizer)

        self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.hsizer.Add(self.content, 1, wx.EXPAND | wx.ALL, 140)
        self.SetSizer(self.hsizer)

        w, h = 400, 400
        self.SetClientSize( (w, h) )
        dc = wx.ClientDC(self)
        destbitmap = wx.EmptyBitmap(w, h)

        temp_dc = wx.MemoryDC();
        temp_dc.SelectObject(destbitmap);
        mimg.draw(temp_dc, wx.Rect(0,0,w,h))
        temp_dc.SelectObject(wx.NullBitmap)
        destbitmap.SetMask(wx.Mask(destbitmap, wx.BLACK))
        self.bmp=destbitmap

        if wx.Platform != "__WXMAC__":
            # wxMac clips the tooltip to the window shape, YUCK!!!
            self.SetToolTipString("Right-click to close the window\n"
                                  "Double-click the image to set/unset the window shape")

        if wx.Platform == "__WXGTK__":
            # wxGTK requires that the window be created before you can
            # set its shape, so delay the call to SetWindowShape until
            # this event.
            self.Bind(wx.EVT_WINDOW_CREATE, self.SetWindowShape)
        else:
            # On wxMSW and wxMac the window has already been created, so go for it.
            self.SetWindowShape()

        dc.DrawBitmap(destbitmap, 0,0,True)
Beispiel #14
0
    def compute_rect(self, image, dcrect):
        # count anchors to
        myanchors = image.get_anchors_to()
        numanchors = len(myanchors)

        #if stretch/tile, assert 0 < numanchorsto < 3
        if image.style != 'static':
            if not (numanchors == 1 or numanchors == 2):
                raise AssertionError('%r is not static but has anchors %r' % (image, image.anchors))

            # if 1, use dc + image offset/align as other "to"
            # compute anchor position(self, DCsize, (0,0))
            # map 0,0 of self to that position
            if numanchors == 1:
                anchorfrom = to_storage(myanchors[0])
                tag = anchorfrom.to
                imageto = self.tags[tag]

                anchorto = to_storage([anchor for anchor in imageto.anchors if
                            anchor['tag'] == tag][0])
                if imageto not in self.drawrects:
                    self.compute_rect(imageto, dcrect)

                rectto1 = self.drawrects[imageto]
                rectto2 = (0,0,dcrect.width,dcrect.height)

                positionto1 = compute_anchor_position(anchorto, rectto1[2:], rectto1[:2])
                positionto2 = compute_anchor_position(get_SI2_anchor(image), rectto2[2:], rectto2[:2])

                #relative position (local anchors)
                positionfrom1 = compute_anchor_position(anchorfrom, [image.width, image.height],
                                                  [0,0])
                positionfrom2 = (0,0)
                diffxto = abs(positionto1[0] - positionto2[0])
                diffyto = abs(positionto1[1] - positionto2[1])
                diffxlocal = abs(positionfrom1[0] - positionfrom2[0])
                diffylocal = abs(positionfrom1[1] - positionfrom2[1])

                increasex = diffxto - diffxlocal
                increasey = diffyto - diffylocal

                newsizew = image.width + increasex
                newsizeh = image.height + increasey

                newlocalanchorposition = positionto2
                positiontodrawat = (positionfrom2[0] + newlocalanchorposition[0],
                                    positionfrom2[1] + newlocalanchorposition[1])
#                print 'positiontodrawat1', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0], positiontodrawat[1],
                                         newsizew, newsizeh)
#                print "self.drawrects[image]", self.drawrects[image]
                return
            #if 2, whatever
            elif numanchors == 2:
                #local anchors
                anchorfrom1, anchorfrom2 = myanchors
                tag1, tag2 = anchorfrom1['to'], anchorfrom2['to']
                imageto1, imageto2 = self.tags[tag1], self.tags[tag2]
                #remote anchors
                anchorto1 = [anchor for anchor in imageto1.get_anchors_to() if
                            anchor['tag'] == tag1]
                anchorto2 = [anchor for anchor in imageto2.get_anchors_to() if
                            anchor['tag'] == tag2]

                if imageto1 not in self.drawrects:
                    self.compute_rect(imageto1, dcrect)
                if imageto2 not in self.drawrects:
                    self.compute_rect(imageto2, dcrect)
                rectto1 = self.drawrects[imageto1]
                rectto2 = self.drawrects[imageto2]
                #absolute position (remote anchors)
                positionto1 = compute_anchor_position(anchorto1, rectto1[2:], rectto1[:2])
                positionto2 = compute_anchor_position(anchorto2, rectto2[2:], rectto2[:2])

                #relative position (local anchors)
                positionfrom1 = compute_anchor_position(anchorfrom1, [image.imgw, image.imgh],
                                                  [0,0])
                positionfrom2 = compute_anchor_position(anchorfrom2, [image.imgw, image.imgh],
                                                  [0,0])
                #CAS: check relative positioning here

                diffxto = abs(positionto1[0] - positionto2[0])
                diffyto = abs(positionto1[1] - positionto2[1])
                diffxlocal = abs(positionfrom1[0] - positionfrom2[0])
                diffylocal = abs(positionfrom1[1] - positionfrom2[1])

                increasex = diffxto - diffxlocal
                increasey = diffyto - diffylocal

                newsizew = image.imgw + increasex
                newsizeh = image.imgh + increasey
                #compute new position of one local anchor on new size
                newlocalanchorposition = compute_anchor_position(anchorfrom1, newsizew,newsizeh,[0,0])
                #subtract from position of remote anchor to find the absolute position of this image

                positiontodrawat = (positionto1[0] - newlocalanchorposition[0],
                                    positionto1[1] - newlocalanchorposition[1])
#                print 'positiontodrawat2', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0], positiontodrawat[1],
                                         newsizew, newsizeh)
                return
            else:
                raise AssertionError("invalid skin, wrong number"
                                     " (%d) of anchors for "
                                     "image of type %s!" %
                                     (numanchors,
                                      image.image_dictionary['style']))
        #else assert -1 < numanchors < 2
        else:
            assert(numanchors == 0 or numanchors == 1)
            #if 0, use dc + image offset/align as "to"
            #compute anchor position(self, DCsize, (0,0))
            #draw at that position
            #print numanchors, image
            if numanchors == 0:
#                print "image", image
#                print dir(image)
#                print "anchor", get_SI2_anchor(image)

                positiontodrawat = compute_anchor_position(get_SI2_anchor(image), (dcrect.width, dcrect.height),
                                       [0,0])
#                print 'positiontodrawat3', positiontodrawat
                #rect = our offset and size
                #print "adding", image.image_dictionary, "to drawrects"
                self.drawrects[image] = (positiontodrawat[0], positiontodrawat[1],
                                         image.width, image.height)
#                print "self.drawrects[image]", self.drawrects[image]
                return
                #draw this image there
            #if 1, whatever
            elif numanchors == 1:
                anchorfrom = image.get_anchors_to()[0]
                tag = anchorfrom['to']
                imageto = self.tags[tag]
                anchorto = [anchor for anchor in imageto.get_anchors_to() if
                            anchor['tag'] == tag]
                if imageto not in self.drawrects:
                    self.compute_rect(imageto, dcrect)
                rectto = self.drawrects[imageto]
                #absolute position
                positionto = compute_anchor_position(anchorto, rectto[2:], rectto[:2])
                #relative position
                positionfrom = compute_anchor_position(anchorfrom, [image.width, image.height],
                                                  [0,0])
                positiontodrawat = (positionto[0] - positionfrom[0],
                                    positionto[1] - positionfrom[1])
#                print 'positiontodrawat4', positiontodrawat
                self.drawrects[image] = (positiontodrawat[0], positiontodrawat[1],
                                         image.width, image.height)
                return
            else:
                raise AssertionError("invalid skin, wrong number"
                                     " (%d) of anchors for "
                                     "image of type %s!" %
                                     (numanchors,
                                      image.image_dictionary['style']))
Beispiel #15
0
        retval['halign'] = image.halign
    return retval

def main(images):
    temp_dc = wx.MemoryDC();
    temp_dc.SelectObject(destbitmap);
    mimg = MultiImage(images)
    drawrect = wx.Rect(10,10,220,440)
    mimg.draw(temp_dc, drawrect)

    temp_dc.SelectObject(wx.NullBitmap)



if __name__ == '__main__':
    import util, syck
    from skins import images as imgmngr
    from skins import skins
    app = wx.PySimpleApp()

#    image['source'] = 'skins/default/checkerboard9.png'
    skins.res_path = "../../res/"
    destbitmap = imgmngr.get('skins/default/blue-flower.jpg')
    f = file("../../res/skins/skinExample")
    
    images = to_storage(syck.load(f)).Images
    f.close()
    util.profile(main, images)
    destbitmap.SaveFile('C:/workspace/Digsby/res/skins/default/output.png',
                     wx.BITMAP_TYPE_PNG)
Beispiel #16
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "Shaped Window",
                          style=wx.FRAME_SHAPED | wx.SIMPLE_BORDER
                          | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP)

        self.hasShape = False
        self.delta = (0, 0)

        [
            self.Bind(e, m) for e, m in [
                (wx.EVT_LEFT_DCLICK, self.OnDoubleClick),
                (wx.EVT_LEFT_DOWN, self.OnLeftDown),
                (wx.EVT_LEFT_UP, self.OnLeftUp),
                (wx.EVT_MOTION, self.OnMouseMove),
                (wx.EVT_RIGHT_UP, self.OnExit),
                (wx.EVT_PAINT, self.OnPaint),
            ]
        ]

        from skins import images as imgmngr
        from skins import skins

        f = file("../../res/skins/halloween/skin.yaml")
        images = util.to_storage(yaml.load(f)).Images
        f.close()

        skins.res_path = "../../res/skins/halloween"

        mimg = MultiImage(images)

        from gui.uberwidgets.UberBar import UberBar as UberBar
        from gui.uberwidgets.UberButton import UberButton as UberButton

        self.content = wx.Panel(self)

        innerSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.bsizer = wx.BoxSizer(wx.VERTICAL)
        self.menu = UberBar(self.content)
        [
            self.menu.add(UberButton(self.menu, -1, s))
            for s in 'Digsby Edit Help'.split()
        ]

        self.bsizer.Add(self.menu, 0, wx.EXPAND, 0)
        self.content.SetSizer(self.bsizer)

        self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.hsizer.Add(self.content, 1, wx.EXPAND | wx.ALL, 140)
        self.SetSizer(self.hsizer)

        w, h = 400, 400
        self.SetClientSize((w, h))
        dc = wx.ClientDC(self)
        destbitmap = wx.EmptyBitmap(w, h)

        temp_dc = wx.MemoryDC()
        temp_dc.SelectObject(destbitmap)
        mimg.draw(temp_dc, wx.Rect(0, 0, w, h))
        temp_dc.SelectObject(wx.NullBitmap)
        destbitmap.SetMask(wx.Mask(destbitmap, wx.BLACK))
        self.bmp = destbitmap

        if wx.Platform != "__WXMAC__":
            # wxMac clips the tooltip to the window shape, YUCK!!!
            self.SetToolTipString(
                "Right-click to close the window\n"
                "Double-click the image to set/unset the window shape")

        if wx.Platform == "__WXGTK__":
            # wxGTK requires that the window be created before you can
            # set its shape, so delay the call to SetWindowShape until
            # this event.
            self.Bind(wx.EVT_WINDOW_CREATE, self.SetWindowShape)
        else:
            # On wxMSW and wxMac the window has already been created, so go for it.
            self.SetWindowShape()

        dc.DrawBitmap(destbitmap, 0, 0, True)