关键词不能为空

当前您在: 主页 > 英语 >

基于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应用的自动升级详解的相关文章

  • 余华爱情经典语录,余华爱情句子

    余华的经典语录——余华《第七天》40、我不怕死,一点都不怕,只怕再也不能看见你——余华《第七天》4可是我再也没遇到一个像福贵这样令我难忘的人了,对自己的经历如此清楚,

    语文
  • 心情低落的图片压抑,心情低落的图片发朋友圈

    心情压抑的图片(心太累没人理解的说说带图片)1、有时候很想找个人倾诉一下,却又不知从何说起,最终是什么也不说,只想快点睡过去,告诉自己,明天就好了。有时候,突然会觉得

    语文
  • 经典古训100句图片大全,古训名言警句

    古代经典励志名言100句译:好的药物味苦但对治病有利;忠言劝诫的话听起来不顺耳却对人的行为有利。3良言一句三冬暖,恶语伤人六月寒。喷泉的高度不会超过它的源头;一个人的事

    语文
  • 关于青春奋斗的名人名言鲁迅,关于青年奋斗的名言鲁迅

    鲁迅名言名句大全励志1、世上本没有路,走的人多了自然便成了路。下面是我整理的鲁迅先生的名言名句大全,希望对你有所帮助!当生存时,还是将遭践踏,将遭删刈,直至于死亡而

    语文
  • 三国群英单机版手游礼包码,三国群英手机单机版攻略

    三国群英传7五神兽洞有什么用那是多一个武将技能。青龙飞升召唤出东方的守护兽,神兽之一的青龙。玄武怒流召唤出北方的守护兽,神兽之一的玄武。白虎傲啸召唤出西方的守护兽,

    语文
  • 不收费的情感挽回专家电话,情感挽回免费咨询

    免费的情感挽回机构(揭秘情感挽回机构骗局)1、牛牛(化名)向上海市公安局金山分局报案,称自己为了挽回与女友的感情,被一家名为“实花教育咨询”的情感咨询机构诈骗4万余元。

    语文