def PerformStopRecordingTask(self, Params): #<?xml version="1.0" encoding="utf-8"?> #<Marvin Type="OscarTask"> # <Version>1.0</Version> # <OscarID>DemoOscar</OscarID> # <Task>StopRecording</Task> # <Param>File=SaveFile.glk</Param> #</Marvin> fileName = None param = "" if len(Params) > 0: param = Params[0] parts = param.split("=") if len(parts) == 2: if parts[0].lower() == 'file': fileName = Alias.Alias(parts[1]) if None == fileName: Log.getLogger().error( "Received invalid Stop Recording task. No save file: " + str(param)) return GuiMgr.OnStopRecording() GuiMgr.WriteToFile(fileName)
def StartupWorkerProc(fnKillSignalled, userData): downstreamServer = userData[0] upstreamServer = userData[1] Sleep.SleepMs(500) downstreamServer.Start() upstreamServer.DropPackets(True) upstreamServer.Start() Watchdog.ConnectionUpdateTimer() Watchdog.WatchdogTimer() conf = Configuration.get() if None != conf.GetAutorunFilename(): GuiMgr.OnStopLiveData() #GuiMgr.OnStopPlayback() #GuiMgr.OnStopRecording(True) #drop all recorded packets GuiMgr.OnSetPlaybackSpeed(Configuration.get().GetPlaybackSpeed()) ss = Configuration.get().GetAutorunLocations() #GuiMgr.OnEnablePlayback() GuiMgr.ReadFromFile(Configuration.get().GetAutorunFilename()) GuiMgr.OnStopPlayback() Sleep.SleepMs( 100) # let gui worker threads catch up, so gui updates properly GuiMgr.OnStartPlayback() GuiMgr.OnSetRepeatMode(Configuration.get().GetAutoRunMode(), ss[0], ss[1]) else: upstreamServer.DropPackets(False) if None != conf.GetAutorunTime() and conf.GetAutorunTime( ) > 0: # specified a --time, so let's hang out for that long endTime = Time.GetCurrMS() + conf.GetAutorunTime() * 60 * 1000 Log.getLogger().info("Waiting for " + str(conf.GetAutorunTime()) + " minutes before auto shutdown") if conf.GetRecordFilename(): GuiMgr.OnStartRecording() while not fnKillSignalled() and endTime > Time.GetCurrMS(): Sleep.SleepMs(250) Log.getLogger().info("Shutting down after time period") if conf.GetRecordFilename( ): # was a recording session, so quit after that time GuiMgr.OnStopRecording() GuiMgr.WriteToFile(conf.GetRecordFilename()) Log.getLogger().info("Saving Recorded data to file: " + conf.GetRecordFilename()) GuiMgr.Quit()
def HandleSave(self): options = {} options['filetypes'] = [('Oscar Data files', '.biff')] options['initialfile'] = 'OscarSaveFile.biff' options['defaultextension'] = '.biff' options['parent'] = self.root filename = tkinter.filedialog.asksaveasfilename(**options) if len(filename) < 1: return GuiMgr.WriteToFile(filename) GuiMgr.SetPlaybackFilename(filename)