コード例 #1
0
 def Load(self):
     ret = eve.Message(
         'CustomWarning', {
             'header':
             'Load Settings',
             'warning':
             'Note that you have to restart after loading new settings'
         }, uiconst.OKCANCEL)
     if ret == uiconst.ID_CANCEL:
         return
     path = settings.public.ui.Get('LoadSettingsPath', None)
     selection = uix.GetFileDialog(path=path,
                                   fileExtensions=['yaml'],
                                   multiSelect=False,
                                   selectionType=uix.SEL_FILES)
     if selection is None or len(
             selection.files) < 1 or selection.files[0] == '':
         return
     fileName = selection.files[0]
     folder = '\\'.join(fileName.split('\\')[:-1])
     save = eve.Message(
         'CustomQuestion', {
             'header': 'Save Current Settings?',
             'question': 'Do you want to save your current settings?'
         }, uiconst.YESNO)
     if save == uiconst.ID_YES:
         self.SaveCurrentSettings(folder)
     self.LoadSettings(fileName)
     settings.public.ui.Set('LoadSettingsPath', folder)
     appUtils.Reboot('Settings loaded')
コード例 #2
0
 def ShowDisconnectNotice(self, notice=None):
     notice = notice or localization.GetByLabel(
         'UI/Shared/GenericConnectionLost')
     msgbox = form.MessageBox.Open(windowID='DisconnectNotice',
                                   parent=uicore.desktop,
                                   idx=0)
     msgbox.MakeUnResizeable()
     msgbox.MakeUnpinable()
     msgbox.MakeUnKillable()
     msgbox.Execute(
         notice,
         localization.GetByLabel('UI/Shared/ConnectionLost'),
         uiconst.OKCANCEL,
         uiconst.INFO,
         None,
         okLabel=localization.GetByLabel('UI/Commands/CmdRestart'),
         cancelLabel=localization.GetByLabel('UI/Commands/CmdQuit'))
     uicore.layer.hint.display = False
     blackOut = uicls.Fill(parent=uicore.layer.modal,
                           color=(0, 0, 0, 0),
                           idx=1)
     uicore.animations.MorphScalar(blackOut,
                                   'opacity',
                                   startVal=0,
                                   endVal=0.75,
                                   duration=1.0)
     modalResult = msgbox.ShowModal()
     if modalResult == uiconst.ID_OK:
         appUtils.Reboot('connection lost')
     else:
         bluepy.Terminate('User requesting close after client disconnect')
コード例 #3
0
 def CleanupOptionalUpgrades(self):
     deleted = nasty.CleanupAppDataCodeFiles()
     if deleted < 1:
         self.LogError("CleanupAppDataCodeFiles didn't delete anything")
         uicore.Message('CompiledCodeCantCleanup', {'folder': nasty.GetCompiledCodePath()})
     self.LogNotice('Restarting client after updates cleanup')
     settings.public.ui.Set('DeniedClientUpgrades', [])
     appUtils.Reboot('Compiled.Code Cleanup')
コード例 #4
0
    def DownloadOptionalUpgrade(self, upgradeInfo):
        try:
            downloadDirectory = nasty.GetAppDataCompiledCodePath().path
            filename = unicode(upgradeInfo.build) + u'.code'
            destination = os.path.join(downloadDirectory, filename)
            destination = os.path.normcase(destination)
            tempfile = 'temp_%s_dl.tmp' % upgradeInfo.hash
            tempfile = os.path.normcase(os.path.join(downloadDirectory, tempfile))
            if os.path.exists(tempfile):
                os.remove(tempfile)
            if not os.path.exists(downloadDirectory):
                os.makedirs(downloadDirectory)
            self.LogInfo('Starting download of new compiled.code file')
            SetDownloadProgress(0, localization.GetByLabel('/Carbon/UI/Patch/Downloading'))
            try:
                urllib.urlretrieve(upgradeInfo.fileurl, tempfile, CodeDownLookHook)
                self.LogInfo('Completed downloading compiled.code file to: ' + tempfile)
                readBytes = blue.win32.AtomicFileRead(tempfile)[0]
                cp = blue.crypto.GetVerContext()
                hasher = blue.crypto.CryptCreateHash(cp, blue.crypto.CALG_MD5, None)
                blue.crypto.CryptHashData(hasher, readBytes)
                thehash = blue.crypto.CryptGetHashParam(hasher, blue.crypto.HP_HASHVAL)
                hasher.Destroy()
                tempfilehash = base64.b64encode(thehash).strip().replace('/', '_')
                if tempfilehash == upgradeInfo.hash:
                    if os.path.exists(destination):
                        os.remove(destination)
                    self.LogInfo('Renaming tempfile: %s to final location: %s' % (tempfile, destination))
                    os.rename(tempfile, destination)
                    uicore.Message('CodePatchApplied')
                    appUtils.Reboot('Compiled.Code Update')
                else:
                    self.LogError('Error getting new .code file: hash mismatch. Got %s expected %s' % (tempfilehash, upgradeInfo.hash))
                    uicore.Message('CompiledCodeDownloadFailed')
            finally:
                SetDownloadProgress(1000, localization.GetByLabel('/Carbon/UI/Patch/Downloading'))

        except Exception as e:
            self.LogError('Error getting new .code file: ', e)
            uicore.Message('CompiledCodeDownloadFailed')
            if nasty.IsRunningWithOptionalUpgrade():
                self.HandleObsoleteUpgrade()
コード例 #5
0
ファイル: benchmark1.py プロジェクト: R4M80MrX/eve-1
    def connectionTest(self, *args):
        timeperiod = prefs.GetValue('csduration')
        count = prefs.GetValue('cscount')
        if count > 0:
            count -= 1
            prefs.SetValue('bmnextrun', count)
            prefs.SetValue('cscount', count)
            for a in xrange(timeperiod, -1, -1):
                SleepSim(1000)
                sm.GetService('gameui').Say(
                    'Connection test in progress.<br>%s seconds until restart, %s runs left.'
                    % (a, count))

            sm.GetService('gameui').Say(
                'Connection test in progress.<br>Current cycle complete, rebooting!'
            )
            completedsofar = prefs.GetValue('cscompleted', 0)
            prefs.SetValue('cscompleted', completedsofar + 1)
            SleepSim(2000)
            text = 'Client Stats test, %s runs left' % count
            appUtils.Reboot(text)
コード例 #6
0
 def CmdLogOff(self):
     if uicore.Message('AskLogoffGame', {}, uiconst.YESNO,
                       uiconst.ID_YES) == uiconst.ID_YES:
         appUtils.Reboot('Generic Logoff')
コード例 #7
0
 def HandleProtocolMismatch(self):
     if nasty.IsRunningWithOptionalUpgrade():
         if uicore.Message('CompiledCodeMachoNetVersionMismatch', {}, uiconst.YESNO, default=uiconst.ID_NO) == uiconst.ID_YES:
             nasty.CleanupAppDataCodeFiles()
             appUtils.Reboot('MachoNet Version Mismatch using optional upgrade')
コード例 #8
0
 def ClearSettings(self):
     if eve.Message('AskClearSettingsReboot', {},
                    uiconst.YESNO) == uiconst.ID_YES:
         prefs.resetsettings = 1
         appUtils.Reboot('clear settings')
コード例 #9
0
 def ClearCacheFiles(self):
     if eve.Message('AskClearCacheReboot', {},
                    uiconst.YESNO) == uiconst.ID_YES:
         prefs.clearcache = 1
         appUtils.Reboot('clear cache')