import wx import wx.html class HTMLFrame(wx.Frame): """桌面程序主窗口类""" def __init__( self, parent, tip_text, web_text, window_title: str = "新版本已发布", bg_colour: tuple = (0, 0, 0), window_size: tuple = (800, 480), ): """构造函数""" wx.Frame.__init__( self, parent, id=wx.ID_ANY, title=window_title, pos=wx.DefaultPosition, size=window_size, style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL, ) # self.SetIcon(wx.Icon('', wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour(bg_colour) self.Center() self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, tip_text, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTER_HORIZONTAL, ) self.m_staticText1.Wrap(-1) self.m_staticText1.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize() * 2, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "OPPOSans M", ) ) bSizer1.Add(self.m_staticText1, 3, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.m_htmlWin1 = wx.html.HtmlWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.html.HW_SCROLLBAR_AUTO, ) self.m_htmlWin1.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "OPPOSans R", ) ) self.m_htmlWin1.SetStandardFonts(normal_face="OPPOSans R") bSizer1.Add(self.m_htmlWin1, 5, wx.EXPAND | wx.RESERVE_SPACE_EVEN_IF_HIDDEN, 5) bSizer2 = wx.BoxSizer(wx.HORIZONTAL) self.m_button1 = wx.Button( self, wx.ID_ANY, "取消", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add(self.m_button1, 0, wx.ALL, 5) self.m_button2 = wx.Button( self, wx.ID_ANY, "更新", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add(self.m_button2, 0, wx.ALL, 5) bSizer1.Add(bSizer2, 0, wx.ALIGN_RIGHT, 5) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) self.m_htmlWin1.SetPage(web_text) # Connect Events self.m_button1.Bind(wx.EVT_BUTTON, self.on_Cancel_Click) self.m_button2.Bind(wx.EVT_BUTTON, self.on_Update_Click) self.ok = False def __del__(self): # return self.ok pass def getok(self) -> bool: return self.ok # Virtual event handlers, override them in your derived class def on_Cancel_Click(self, event): self.ok = False self.Destroy() def on_Update_Click(self, event): self.ok = True self.Destroy() def go_update_tip(tip_text: str, html_context: str) -> bool: app = wx.App() frame = HTMLFrame( None, tip_text, html_context, bg_colour=wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENU), ) frame.Show() app.MainLoop() return frame.getok() if __name__ == "__main__": go_update_tip( "!有新版本!\n最新的 {app} 已经是 {latest} 版本,当前您正在使用的仍是 {current} 版本,是否更新?", '
我们使用Python库 dill
和 Brotli
对整个库的包体进行打包,方式如下:
packing_bytes = brotli.compress(dill.dumps(sth,))\n
\n\n每个包中的内容为:
\nMSCT_MAIN = (\n Musicreater,\n Musicreater.experiment,\n Musicreater.previous,\n)\n\nMSCT_PLUGIN = (Musicreater.plugin,)\n\nMSCT_PLUGIN_FUNCTION = (\n to_addon_pack_in_delay,\n to_addon_pack_in_repeater,\n to_addon_pack_in_score,\n to_mcstructure_file_in_delay,\n to_mcstructure_file_in_repeater,\n to_mcstructure_file_in_score,\n to_BDX_file_in_delay,\n to_BDX_file_in_score,\n)\n
\n\n