关键词不能为空

当前您在: 主页 > 英语 >

基于esky实现python应用的自动升级详解

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-07 10:27
tags:

-

2021年2月7日发(作者:脆)


基于


esky


实现


py thon


应用的自动升级




一、


esky


介绍




Esky is an auto-update framework for frozen Python applications. It provides a simple API through which apps can find, fetch and install


updates, and a bootstrapping mechanism that keeps the app safe in the face of failed or partial updates. Updates can also be sent as


differential patches.



Esky is currently capable of freezing apps with py2exe, py2app, cxfreeze and bbfreeze. Adding support for other freezer programs should


be easy; patches will be gratefully accepted.



We are tested and running on Python 2.7 Py2app will work on python3 fine, the other freezers not so much.



Esky


是一个


python


编译程序的自动升级框架,


提供 简单的


api


实现应用的自动更新


(包 括比较版本、


更新版本)



esky< /p>


支持


py2exe


py2app



cxfreeze


以及


bbfreeze


等多种


pyth on


打包框架。



< br>二、


esky


安装及说明




1



pip


安装




pip install esky



2



esky


说明

< br>



/cloudmatrix/esky/



3



esk y


教学视频




/pycon-au-2010/



三、


esky


用法示例




esky


用起来比较简单,我们这里 以常用的基于


wx



windows< /p>


应用举例。




wxpython


下有个


reupdate

< br>类,对


wxpython


应用的


esky


升级进行了二次封装。



< /p>


网上有个现成的示范例子,具体网址:


/


2013


/


07


/12


/wxpython-updating-your-application-with-esky/



代码很简单,对其中的关键部分进行注释说明(红色字体部分 ):




复制代码



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


# image_


#


# Created 03-20-2010


#


# Author: Mike Driscoll


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



import glob


import os


import wx


from import setuparg1



from import



pub as Publisher



#


申明语句



from reupdate import SoftwareUpdate



import version



####################################### #################################


class ViewerPanel():












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






def __init__(self, parent):



















.__init__(self, parent)



















width, height = ySize()










hs = []










tPicture = 0










ictures = 0










axSize = height - 200










ibe(Images, (











imer = (None)










(_TIMER, )



















()















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






def layout(self):



















Layout the widgets on the panel




























zer = er(AL)










btnSizer = er(NTAL)



















img = mage(axSize,axSize)










trl = Bitmap(self, _ANY


,












































FromImage(img))










(trl, 0, |, 5)










abel = Text(self, label=










(abel, 0, |, 5)



















btnData = [(





















(





















(










for data in btnData:














label, sizer, handler = data














lder(label, sizer, handler)























(btnSizer, 0, )










er(zer)



















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






def btnBuilder(self, label, sizer, handler):



















Builds a button, binds it to an event handler and adds it to a sizer



















btn = (self, label=label)










(_BUTTON, handler)










(btn, 0, |, 5)















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






def loadImage(self, image):



















image_name = me(image)










img = (image, _TYPE_ANY)










# scale the image, preserving the aspect ratio










W = th()










H = ght()










if W > H:














NewW = axSize














NewH = axSize * H / W










else:














NewH = axSize














NewW = axSize * W / H










img = (NewW,NewH)











map(FromImage(img))










el(image_name)










h()










ssage(















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






def nextPicture(self):



















Loads the next picture in the directory



















if tPicture == ictures-1:














tPicture = 0










else:














tPicture += 1










age(hs[tPicture])















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






def previousPicture(self):



















Displays the previous picture in the directory



















if tPicture == 0:














tPicture = ictures - 1










else:














tPicture -= 1










age(hs[tPicture])















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






def update(self, event):



















Called when the slideTimer's timer event fires. Loads the next










picture from the folder by calling th nextPicture method



















cture()















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






def updateImages(self, msg):



















Updates the picPaths list to contain the current folder's images



















hs =










ictures = len(hs)










age(hs[0])















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






def onNext(self, event):



















Calls the nextPicture method



















cture()











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






def onPrevious(self, event):



















Calls the previousPicture method



















usPicture()











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






def onSlideShow(self, event):



















Starts and stops the slideshow



















btn = ntObject()










label = el()










if label ==














(3000)














el(










else:














()














el(




















### ################################################## ###################


class ViewerFrame():












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






def __init__(self):



















title = 'Image Viewer %s' %(N)
















.__init__(self, None, title=title)










panel = ViewerPanel(self)










Path =










ibe(Frame, (



















olbar()










= er(AL)










(panel, 1, )










er()



















()










(self)










()
























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






def initToolbar(self):



















Initialize the toolbar



















r = ToolBar()










lBitmapSize((16,16))



















open_ico = map(_FILE_OPEN, _TOOLBAR, (16,16))










openTool = pleTool(_ANY


, open_ico,










(_MENU, ectory, openTool)



















e()















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






def onOpenDirectory(self, event):



















Opens a DirDialog to allow the user to open a folder with pictures



















dlg = log(self,





























style=_DEFAULT_STYLE)



















if dal() == _OK:














Path = h()














print Path














picPaths = (Path +














print picPaths














ssage(















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






def resizeFrame(self, msg):



















(self)











### ################################################## ###################


#


注意基类是两个


-


-


-


-


-


-


-


-



本文更新与2021-02-07 10:27,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/607993.html

基于esky实现python应用的自动升级详解的相关文章

  • 爱心与尊严的高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊严高中作文题库

    1.关于爱心和尊严的作文八百字 我们不必怀疑富翁的捐助,毕竟普施爱心,善莫大焉,它是一 种美;我们也不必指责苛求受捐者的冷漠的拒绝,因为人总是有尊 严的,这也是一种美。

    小学作文
  • 爱心与尊重的作文题库

    1.作文关爱与尊重议论文 如果说没有爱就没有教育的话,那么离开了尊重同样也谈不上教育。 因为每一位孩子都渴望得到他人的尊重,尤其是教师的尊重。可是在现实生活中,不时会有

    小学作文
  • 爱心责任100字作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任心的作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文
  • 爱心责任作文题库

    1.有关爱心,坚持,责任的作文题库各三个 一则150字左右 (要事例) “胜不骄,败不馁”这句话我常听外婆说起。 这句名言的意思是说胜利了抄不骄傲,失败了不气馁。我真正体会到它

    小学作文