WPKG-GP-Client_phoenix.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码
def on_upgrade(self, event):
        try:
            if self.wpkg_dialog.IsShown():
                # If dialog is opened already, raise window to top
                self.wpkg_dialog.Raise()
                return
        except AttributeError:
            # Dialog is not opened yet
            # Check if Reboot is Pending
            try:
                reboot_pending = ReadRebootPendingTime()
            except WindowsError:
                dlg_msg = _(u'Registry Error\n\nNo access to necessary registry key.')
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                return
            if reboot_pending and reboot_pending > self.bootup_time:
                dlg_msg = _(u"Reboot required!\n\n"
                           u"A reboot is required before the system\n"
                           u"can be updated again.\n"
                           u"Reboot now?")
                dlg = wx.MessageDialog(None, dlg_msg, app_name, wx.YES_NO | wx.YES_DEFAULT | wx.ICON_EXCLAMATION)
                if dlg.ShowModal() == wx.ID_YES:
                    # Initiate Reboot
                    shutdown(1, time=5, msg=_(u"System will reboot now!"))
                    return
                else:
                    return
            elif reboot_pending:
                SetRebootPendingTime(reset=True)
            if update_method and update_interval:
                self.timer.Stop()
            self.wpkg_dialog = RunWPKGDialog(parent=self, title=_(u'System Update'))
            self.wpkg_dialog.ShowModal()
            if self.wpkg_dialog.shutdown_scheduled == True:
                # Shutdown Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
            if self.wpkg_dialog.reboot_scheduled == True:
                # Reboot Scheduled add Cancel Option to Popup Menu
                self.shutdown_scheduled = True
                self.reboot_scheduled = True
            self.wpkg_dialog.Destroy()
            if update_method and update_interval:
                self.timer.Start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号