示例#1
0
    def AddShrimpBtn(self, prnt, idx, shrimp):
        btn_name = SHRIMPBTN_NAME_FMT % idx
        id_name = SHRIMPBTN_ID_FMT % idx
        handler_name = SHRIMPBTN_EVTBUTTON_FMT % idx

        # 1st we make a EVT_BUTTON handler which fires up the corresponding
        # shrimp.
        # the method is adapted from the former OnLvwShrimpListItemActivated
        # handler, adding some cool dynamic stuff
        def _FireUpShrimp(self, event):
            try:
                cooker.bring_up_shrimp(shrimp)
            except ValueError:
                # already running
                wx.MessageBox('error: already running!')
            event.Skip()
        _FireUpShrimp.func_name = handler_name
        fun2meth(_FireUpShrimp, self) # , handler_name)

        # Some identifying info...
        icon_bmap = iconmgr.get_bitmap(shrimp)
        name = cooker.get_name(shrimp)

        # Prepare the button...
        newid = self.__dict__[id_name] = wx.NewId()
        tmp = wx.BitmapButton(prnt, newid, icon_bmap, (0, 0),
                SHRIMPBTN_SIZETUPLE) # , style=SHRIMPBTN_STYLE)
        tmp.SetToolTipString(name)
        self.__dict__[btn_name] = tmp
        tmp.Bind(wx.EVT_BUTTON, getattr(self, handler_name), id=newid)

        # set up layout later, so we are basically done here
        # store some lookup information
        self._ShrimpButtons.append(tmp)
示例#2
0
def show_aboutbox(shrimp, frame):
    # First we create and fill the info object
    info = wx.AboutDialogInfo()
    info.Name = ckr.get_name(shrimp)
    info.Version = ckr.get_version(shrimp)
    info.Copyright = ckr.get_copyright(shrimp)
    info.Description = wordwrap(ckr.get_desc(shrimp), 350, wx.ClientDC(frame))
    # TODO: MUST REPLACE THIS HARDCODED URL WITH REAL VALUE!
    info.WebSite = ('http://bbs.jnrain.com', u'\u6c5f\u5357\u542c\u96e8')
    info.Developers = ckr.get_authors(shrimp)
    info.License = wordwrap(ckr.get_license(shrimp), 400, wx.ClientDC(frame))

    # Then we call wx.AboutBox giving it that info object
    wx.AboutBox(info)