コード例 #1
0
 def LoadVideo(self, path):
     if not os.path.exists(path) and os.path.exists(opj(mediadir, path)):
         path = opj(mediadir, path)
     elif not os.path.exists(path):
         return True
     self.loaded = False
     if DEBUG: print "Trying to load %s" % path
     if not self.mc.Load(path):
         wx.MessageBox("Unable to load %s: Unsupported format?" % path, "ERROR", wx.ICON_ERROR | wx.OK)
         return True
     self.mc.SetInitialSize()
     movies = [opj(mediadir, fn) if not os.path.dirname(fn) else fn for fn in self.vids.GetItems()]
     if not (path in movies or os.path.basename(path) in movies):
         self.vids.Append(path)
         movies.append(path)
     i = movies.index(path)
     self.vids.SetSelection(i)
     self.app.userprofile['video'] = path
     
     self.movieoffset = .25 # FIXME: load from an .ini file
     self.smoothmovieoffset = .25
     wx.CallLater(500, self.OnResize, self)
     wx.CallLater(1500, self.OnResize, self)
     wx.CallLater(2500, self.OnResize, self)
     return False
コード例 #2
0
ファイル: review.py プロジェクト: wjcroft/HEG_ESP32
    def SendToTrash(self, evt=None):
        dlg = wx.MessageDialog(parent=self, caption="Confirm Delete",
                        message="Move this session to the graveyard?", 
                        style=wx.OK|wx.CANCEL|wx.ICON_QUESTION)
        res = dlg.ShowModal()
        if res == wx.ID_OK:
            graveyard = opj(__main__.sessionsdir, __main__.app.user, 'Trash')
            if not os.path.exists(graveyard):
                os.mkdir(graveyard)
                print "Made %s" % graveyard
                
            for fn in (self.path, self.path[:-4]+'.tmg'):
                dst = opj(graveyard, os.path.basename(fn))
                try:
                    os.rename(fn, dst)
                except:
                    if fn == self.path:
                        wx.MessageDialog(self, "Operation failed.").ShowModal()

            # parent should be wx.ScrolledWindow; grandparent should be ReviewFrame
            gramps = self.GetParent().GetParent()
            gramps.panels.remove(self)
            sizer = self.GetParent().GetSizer() 
            sizer.Remove(self)
            self.Destroy()
            gramps.Relayout()
コード例 #3
0
 def __init__(self, *args, **kwargs):
     self.cached_length = None
     if not 'mplayer_path' in kwargs:
         if sys.platform == 'win32':
             kwargs['mplayer_path'] = opj('res', 'mplayer.exe')
         elif sys.platform == 'darwin':
             kwargs['mplayer_path'] = opj('res', 'mplayer-darwin')
         else:
             kwargs['mplayer_path'] = opj('res', 'mplayer')
     kwargs['mplayer_args'] = ['-quiet']
     if not 'id' in kwargs:
         kwargs['id'] = -1
     if not 'sound' in kwargs:
         kwargs['sound'] = False
     #if not 'size' in kwargs:
     #    kwargs['size'] = (320, 240)
     kwargs['pausing'] = True
     self.res = None
     self.last_seek = 25.
     if DEBUG:
         self.seek_count = 0
         self.null_seek_count = 0
         self.first_seek = None
     
     super(MPlayerMediaControl, self).__init__(*args, **kwargs)
コード例 #4
0
 def __init__(self, *args, **kwargs):
     self.paused = False
     if not 'mplayer_path' in kwargs:
         if sys.platform == 'win32':
             kwargs['mplayer_path'] = opj('res', 'mplayer.exe')
         elif sys.platform == 'darwin':
             kwargs['mplayer_path'] = opj('res', 'mplayer-darwin')
         else:
             kwargs['mplayer_path'] = opj('res', 'mplayer')
     kwargs['mplayer_args'] = ['-quiet']
     if not 'id' in kwargs:
         kwargs['id'] = -1
     super(MplayerMovie, self).__init__(*args, **kwargs)
     self.force_keep_pause = True
     self.file_length = None
コード例 #5
0
    def LoadVideo(self, path):
        self.app.userprofile['HEGMovie_video'] = path
        if not hasattr(self, 'mc'):
            self.InitMediaCtrl()
        if DEBUG: print "Loading %s" % path
        if not os.path.exists(path) and os.path.exists(opj(mediadir, path)):
            path = opj(mediadir, path)
        elif not os.path.exists(path) and not (path.startswith('dvd')
                                               and '://' in path):
            if DEBUG: print "That path doesn't seem to exist."
            return True
        self.loaded = False
        if DEBUG: print "Trying to load %s" % path
        if not self.mc.Load(path):
            wx.MessageBox("Unable to load %s: Unsupported format?" % path,
                          "ERROR", wx.ICON_ERROR | wx.OK)
            return True

        if 'HEGMovie_moviePositions' in self.app.userprofile and \
            self.app.userprofile['HEGMovie_video'] in \
            self.app.userprofile['HEGMovie_moviePositions']:
            t = self.app.userprofile['HEGMovie_moviePositions']\
                      [self.app.userprofile['HEGMovie_video']]
            if t > 95.: t = 0
            if DEBUG: print "Seeking to %3.1f" % t
            #self.mc.Seek(t, 1)

        self.mc.SetInitialSize()

        if not self.mc.paused:
            self.mc.paused = True
            self.mc.pausing = True
            self.mc.Pause()

        wx.FutureCall(500, self.OnResize, self)
        wx.FutureCall(1500, self.OnResize, self)
        wx.FutureCall(4500, self.OnResize, self)
        return False
コード例 #6
0
ファイル: review.py プロジェクト: wjcroft/HEG_ESP32
    def FillPanels(self, path, files):
        if DEBUG:
            start = time.time()
        try:
            for f,i in zip(files, range(len(files))):
                if not self.running:
                    return
                wx.Yield()
                self.panels.append(PreviewPanel(opj(path, f), parent=self.panel))
                self.sizer.Add(self.panels[-1], flag=wx.EXPAND)
                self.sizer.Layout()
                self.panel.AdjustScrollbars()
                self.panel.SetSize(self.panel.GetSize())
                self.panels[-1].start()
            #for pan in self.panels:
                while sum([p.running for p in self.panels]) > 2:
                    time.sleep(.1)
                    wx.Yield()
                    for p in self.panels:
                        if p.status == 1:
                            p.UpdatePlot()
                    #if [1 for p in self.panels if p.status != 2]:
                    #    break
                #for p in self.panels:
                #    if p.status == 1:
                #        p.UpdatePlot()
                #pan.start()
                #print 'starting pan'
                #self.Relayout()

                
            while sum([p.running for p in self.panels]) and self.running:
                time.sleep(.1)
                for p in self.panels:
                    if p.status == 1:
                        p.UpdatePlot()
            #if DEBUG: print "All sessions displayed."
            self.panel.AdjustScrollbars()
            self.Relayout()

        except wx.PyDeadObjectError:
            if DEBUG: print "FillPanels was still running at shutdown."
        if DEBUG:
            print "FillPanels took %3.3f seconds" % (time.time() - start)
        self.sizer.Layout()
コード例 #7
0
ファイル: review.py プロジェクト: wjcroft/HEG_ESP32
    def __init__(self, path, *args, **kwargs):
        if not 'size' in kwargs:
            kwargs['size'] = (950, 600)
        if not 'title' in kwargs:
            kwargs['title'] = "Session History - %s - WORKING; please be patient" % path
        if not 'style' in kwargs:
            kwargs['style'] = wx.DEFAULT_FRAME_STYLE #| wx.VSCROLL | wx.HSCROLL
        wx.Frame.__init__(self, *args, **kwargs)
        self.panel = wx.ScrolledWindow(parent=self, style=wx.TAB_TRAVERSAL|wx.NO_BORDER)
        self.panel.SetScrollRate(10,10)
        
        if DEBUG: print "Looking for files."
        files = [f for f in os.listdir(path) if f.lower()[-3:] in parsers.file_extensions
                                                and os.stat(opj(path, f)).st_size > 6144] # 6144 is 10 KiB or about 10 seconds.
        if DEBUG: print "File list built."
        #if DEBUG: print files
        #self.sizer = wx.GridBagSizer(vgap=5)
        self.Show(True)

        wait = wx.MessageDialog(self, message="This might take some time...")
        wait.Show()
        self.panels = []
        #for f,i in zip(files, range(len(files))):
        #    self.panels.append(PreviewPanel(opj(path, f), parent=self.panel))

        #wait.Destroy()

        #self.FitInside()
        #self.sizer.Layout()
        self.panel.SetScrollRate(10,10)
        #self.panel.SetBackgroundColour('black')
        self.Relayout()
        self.running = True
        self.Bind(wx.EVT_IDLE, self.DrawPanels)
        self.FillPanels(path, files)#thread.start_new(self.FillPanels, (path, files,))
        self.SetTitle("Session History - %s" % path)
コード例 #8
0
 def OnVideoCtrl(self, evt=None):
     path = opj(mediadir, evt.GetString())
     self.LoadVideo(path)
コード例 #9
0
    def __init__(self, parent, id, app, blind=False, reverse=False, *args, **kwargs):
        InstrumentsPanel.__init__(self, parent, id, app, blind=blind, *args, **kwargs)
        self.blind = blind
        self.reverse = reverse
        
        sizer = self.sizer
        fgcolor = self.GetForegroundColour()
        bgcolor = self.GetBackgroundColour()
        
        self.loaded = False
        if USE_MPLAYER:
            self.SetDoubleBuffered(False)
        
        if not os.path.exists(mediadir): os.mkdir(mediadir)
        extensions = ['.avi']
        if not USE_MPLAYER:
            extensions.extend(['.wmv', '.mp4', '.mpg', '.m4v'])
        self.mediafiles = [opj(mediadir, fn) for fn in os.listdir(mediadir) 
                      if fn.lower()[-4:] in extensions]
        
        self.mcmutex = thread.allocate_lock()

        self.SetAveragingInterval()
        self.SetSensitivity()


        r, c = self.r, self.c
        
        senstitle = wx.StaticText(parent=self, id=-1, label="Sensitivity: ")
        sizer.Add(senstitle, (r,c), (1,4))
        r += 1
        self.sens = sens = wx.SpinCtrl(parent=self, value=str(int(self.unadjusted_sensitivity)), min=1, max=1000)
        sens.Bind(wx.EVT_SPINCTRL, self.OnSensitivityCtrl)
        sizer.Add(sens, (r,c), (1,4))
        r += 1

        videostitle = wx.StaticText(parent=self, id=-1, label="Video: ")
        sizer.Add(videostitle, (r,c), (1,4))
        r += 1
        self.vids = vids = wx.Choice(parent=self, name="Video: ", choices=[os.path.basename(f) for f in self.mediafiles])
        vids.Bind(wx.EVT_CHOICE, self.OnVideoCtrl)
        sizer.Add(vids, (r,c), (1,4))
        r += 1
        
        feedbacktitle = wx.StaticText(parent=self, id=-1, label="Feedback mode: ")
        sizer.Add(feedbacktitle, (r,c), (1,4))
        r += 1
        
        feedbackchoices = ['Responsive', 'Smooth']
        self.feedback = feedback = wx.Choice(parent=self, name="Feedback mode: ", choices=feedbackchoices)
        feedback.SetSelection(feedbackchoices.index(self.app.userprofile['feedbackmode']))
        feedback.Bind(wx.EVT_CHOICE, self.OnFeedbackMode)
        sizer.Add(feedback, (r,c), (1,4))
        r += 1

        r += 1
                
        self.vids.SetFont(wx.Font(10, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
        videostitle.SetForegroundColour(fgcolor)
        feedbacktitle.SetForegroundColour(fgcolor)
        senstitle.SetForegroundColour(fgcolor)
        self.sens.SetForegroundColour(fgcolor)
        self.sens.SetBackgroundColour(bgcolor)
        self.vids.SetForegroundColour(fgcolor)
        self.vids.SetBackgroundColour(bgcolor)
        
        self.r, self.c = r,c
        
        self.InitMediaCtrl(attach=self.app.userprofile['mcattached'])
        
        sizer.Layout()
コード例 #10
0
ファイル: instrumentspanel.py プロジェクト: wjcroft/HEG_ESP32
    def __init__(self, parent, id, app, blind=False, *args, **kwargs):
        self.app = app

        fgcolor = 'white'
        bgcolor = 'black'
        self.parent = parent
        self.starttime = time.time()
        self.baseline = None
        if not 'style' in kwargs:
            kwargs['style'] = 0
        kwargs['style'] |= wx.FULL_REPAINT_ON_RESIZE
        self.updatetimer, self.hegratio, self.percentchange, self.sessionchange = (
            0., ) * 4
        wx.Panel.__init__(self, parent, id, *args, **kwargs)
        self.SetDoubleBuffered(True)
        self.SetBackgroundColour('black')
        self.SetForegroundColour('white')

        sizer = self.sizer = wx.GridBagSizer(1, 1)
        self.SetSizer(sizer)

        r, c = 0, 0
        self.plot = plotcanvas.PlotCanvas(self)  #, id=-1)
        oldwxplot = False
        try:
            if map(int, wx.version().split(' ')[0].split('.')) < [2, 8, 10]:
                oldwxplot = True
        except:  # beta version of wxpython
            pass
        if not oldwxplot:
            self.plot.SetForegroundColour('gray')
            self.plot.SetGridColour('blue')
            self.plot.SetBackgroundColour('black')
            self.plot.SetYSpec('auto4')
            self.plot.SetEnableAntiAliasing(True)
            self.plot.SetEnableHiRes(True)
            self.plot.SetXSpec('min')
        else:
            self.plot.SetYSpec('auto')

        # Workaround for a bug which causes scrollbars to appear when they shouldn't
        self.plot.SetShowScrollbars = lambda x: None

        self.SetAveragingInterval()

        self.plot.Update([100., 100.], [0., 1.])

        sizer.Add(self.plot, (r, c), (4, 20))

        r += 4

        self.mediarc = r, c

        c = 16

        btnnames = ['play', 'record', 'pause', 'stop']
        self.sessbtns = {}
        for name in btnnames:
            onimg = wx.Image(opj('res', name + '-on.png'))
            offimg = wx.Image(opj('res', name + '-off.png'))
            onimg.Rescale(24, 24, wx.IMAGE_QUALITY_HIGH)
            offimg.Rescale(24, 24, wx.IMAGE_QUALITY_HIGH)
            onbmp = onimg.ConvertToBitmap(32)
            offbmp = onimg.ConvertToBitmap(32)
            btn = wx.lib.buttons.GenBitmapToggleButton(parent=self,
                                                       id=-1,
                                                       bitmap=offbmp)
            btn.SetBitmapSelected(onbmp)
            btn.SetBackgroundColour(bgcolor)
            btn.SetForegroundColour(bgcolor)
            btn.SetUseFocusIndicator(False)
            sizer.Add(btn, (r, c), (1, 1))
            self.sessbtns[name] = btn
            c += 1

        self.sessbtns['play'].SetToggle(True)
        self.sessbtns['play'].Enable(False)
        #if not '--noautosave' in sys.argv: self.sessbtns['record'].SetToggle(True)

        self.sessbtns['play'].Bind(wx.EVT_BUTTON, self.OnPlay)
        self.sessbtns['record'].Bind(wx.EVT_BUTTON, self.OnRecord)
        self.sessbtns['pause'].Bind(wx.EVT_BUTTON, self.OnPause)
        self.sessbtns['stop'].Bind(wx.EVT_BUTTON, self.OnStop)

        c -= 4
        r += 1

        self.timertitletext = wx.StaticText(parent=self,
                                            id=-1,
                                            label="Session time: ")
        sizer.Add(self.timertitletext, (r, c), (1, 4))
        r += 1
        self.datatimertext = wx.StaticText(parent=self, id=-1, label='00:00')
        sizer.Add(self.datatimertext, (r, c), (1, 4))
        r += 1

        self.hegratiotitletext = wx.StaticText(parent=self,
                                               id=-1,
                                               label="HEG ratio: ")
        sizer.Add(self.hegratiotitletext, (r, c), (1, 4))
        r += 1
        self.hegratiotext = wx.StaticText(parent=self, id=-1, label=" 0.0")
        sizer.Add(self.hegratiotext, (r, c), (1, 4))
        r += 1

        self.hegbaselinetitletext = wx.StaticText(parent=self,
                                                  id=-1,
                                                  label="HEG baseline: ")
        sizer.Add(self.hegbaselinetitletext, (r, c), (1, 4))
        r += 1
        self.hegbaselinetext = wx.StaticText(parent=self, id=-1, label=" 0.0")
        sizer.Add(self.hegbaselinetext, (r, c), (1, 4))
        r += 1

        self.percentchangetitletext = wx.StaticText(parent=self,
                                                    id=-1,
                                                    label="Current gain: ")
        sizer.Add(self.percentchangetitletext, (r, c), (1, 4))
        r += 1
        self.percentchangetext = wx.StaticText(parent=self,
                                               id=-1,
                                               label=" 0.0%")
        sizer.Add(self.percentchangetext, (r, c), (1, 4))
        r += 1

        self.sessionchangetitletext = wx.StaticText(parent=self,
                                                    id=-1,
                                                    label="Session gain: ")
        sizer.Add(self.sessionchangetitletext, (r, c), (1, 4))
        r += 1
        self.sessionchangetext = wx.StaticText(parent=self,
                                               id=-1,
                                               label=" 0.0%")
        self.sessionchangetext.SetForegroundColour('white')
        sizer.Add(self.sessionchangetext, (r, c), (1, 4))
        r += 1

        #self.timertext.SetFont(wx.Font(24, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
        self.datatimertext.SetFont(
            wx.Font(24, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))
        self.hegratiotext.SetFont(
            wx.Font(24, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))
        self.hegbaselinetext.SetFont(
            wx.Font(24, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))
        self.percentchangetext.SetFont(
            wx.Font(32, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))
        self.sessionchangetext.SetFont(
            wx.Font(32, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD))

        self.datatimertext.SetDoubleBuffered(True)
        self.hegratiotext.SetDoubleBuffered(True)
        self.hegbaselinetext.SetDoubleBuffered(True)
        self.percentchangetext.SetDoubleBuffered(True)
        self.sessionchangetext.SetDoubleBuffered(True)

        self.timertitletext.SetForegroundColour(fgcolor)
        #self.timertext.SetForegroundColour('grey')
        #self.datatimertitletext.SetForegroundColour(fgcolor)
        self.datatimertext.SetForegroundColour(fgcolor)
        self.hegratiotitletext.SetForegroundColour(fgcolor)
        self.hegratiotext.SetForegroundColour('green')
        self.hegbaselinetitletext.SetForegroundColour(fgcolor)
        self.hegbaselinetext.SetForegroundColour(fgcolor)
        self.percentchangetitletext.SetForegroundColour(fgcolor)
        self.percentchangetext.SetForegroundColour('green')
        self.sessionchangetitletext.SetForegroundColour(fgcolor)
        self.sessionchangetext.SetForegroundColour('yellow')

        self.r, self.c = r, c

        sizer.Layout()
コード例 #11
0
ファイル: review.py プロジェクト: wjcroft/HEG_ESP32
    def __init__(self, path, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)
        #self.filenametext    = wx.StaticText(parent=self, label=os.path.basename(path))
        self.baselinetext    = wx.StaticText(parent=self, label='Baseline: \t\t\t            ')
        self.averagetext     = wx.StaticText(parent=self, label='Average:  \t')
        self.endtext         = wx.StaticText(parent=self, label='Final:    \t')
        self.loadingtext     = wx.StaticText(parent=self, label='Loading:  \t %s' % os.path.basename(path))

        self.FOVtitletext    = wx.StaticText(parent=self, label='')
        self.FOVbaselinetext = wx.StaticText(parent=self, label='')
        self.FOVaveragetext  = wx.StaticText(parent=self, label='')
        self.FOVendtext      = wx.StaticText(parent=self, label='')

        if not hasattr(self, 'handbmp'):
            handimg  = plotcanvas.plot.Hand.GetImage()
            handimg.Rescale(16, 22, wx.IMAGE_QUALITY_HIGH)
            PreviewPanel.handbmp = handimg.ConvertToBitmap(32)
        if not hasattr(self, 'ptrbmp'):
            PreviewPanel.ptrbmp = wx.Image(opj('res', 'pointer.png')).ConvertToBitmap(32)
        if not hasattr(self, 'zoombmp'):
            PreviewPanel.zoombmp  = wx.Image(opj('res', 'zoom.png')).ConvertToBitmap(32)
        if not hasattr(self, 'trashbmp'):
            PreviewPanel.trashbmp = wx.Image(opj('res', 'grave.png')).ConvertToBitmap(32)# 'trashcan.png'
        
        self.ptrbtn   = wx.lib.buttons.GenBitmapToggleButton(parent=self, bitmap=self.ptrbmp)
        self.handbtn  = wx.lib.buttons.GenBitmapToggleButton(parent=self, bitmap=self.handbmp)
        self.zoombtn  = wx.lib.buttons.GenBitmapToggleButton(parent=self, bitmap=self.zoombmp)
        self.trashbtn = wx.lib.buttons.GenBitmapButton      (parent=self, bitmap=self.trashbmp)
        
        self.ptrbtn.Bind  (wx.EVT_BUTTON, lambda evt: (self.ClearBtns(), self.plot.SetEnableZoom(False), self.plot.SetEnableDrag(False)))
        self.handbtn.Bind (wx.EVT_BUTTON, lambda evt: (self.ClearBtns(), self.plot.SetEnableDrag(True)))
        self.zoombtn.Bind (wx.EVT_BUTTON, lambda evt: (self.ClearBtns(), self.plot.SetEnableZoom(True)))
        self.trashbtn.Bind(wx.EVT_BUTTON, self.SendToTrash)
        
        bgcolor = self.GetBackgroundColour()
        for btn in (self.ptrbtn, self.handbtn, self.zoombtn, self.trashbtn):
            btn.SetBackgroundColour(bgcolor)
            btn.SetForegroundColour(bgcolor)
            btn.SetUseFocusIndicator(False)
        
        self.sizer = wx.GridBagSizer(vgap=0, hgap=0)
        self.plot = plotcanvas.PlotCanvas(self, color='black')
        if map(int, wx.version().split(' ')[0].split('.')) < [2, 8, 10]:
            oldwxplot = True
        else:
            oldwxplot = False
        if not oldwxplot:
            self.plot.SetForegroundColour('black')
            self.plot.SetBackgroundColour(self.GetBackgroundColour())
            self.plot.SetGridColour('black')
            self.plot.SetYSpec('auto')
            self.plot.SetEnableAntiAliasing(True)
            self.plot.SetEnableHiRes(True)
            self.plot.SetXSpec('min')
            self.plot.SetFontSizeTitle(12)
            #self.plot.SetEnableZoom(True)
        else:
            self.plot.SetYSpec('auto')

        # Workaround for a bug which causes scrollbars to appear when they shouldn't
        self.plot.SetShowScrollbars = lambda x: None
        self.plot.SetMinSize((700, 250))
        #self.plot.SetBestFittingSize((2048, 500))
        
        self.sizer.Add(self.plot, pos=(0,4), span=(11,1), border=0, flag=wx.EXPAND)
        #self.sizer.Add(self.filenametext, pos=(0,2), span=(1,1), border=0)
        self.sizer.Add(self.baselinetext,    pos=(2,0),  span=(1,4), border=0)
        self.sizer.Add(self.averagetext,     pos=(3,0),  span=(1,4), border=0)
        self.sizer.Add(self.endtext,         pos=(4,0),  span=(1,4), border=0)
        self.sizer.Add(self.loadingtext,     pos=(1,0),  span=(1,4), border=0)
        self.sizer.Add(self.FOVtitletext,    pos=(7,0),  span=(1,4), border=0)
        self.sizer.Add(self.FOVbaselinetext, pos=(8,0),  span=(1,4), border=0)
        self.sizer.Add(self.FOVaveragetext,  pos=(9,0),  span=(1,4), border=0)
        self.sizer.Add(self.FOVendtext,      pos=(10,0), span=(1,4), border=0)
        self.sizer.Add(self.ptrbtn,          pos=(0,0),  span=(1,1), border=0)
        self.sizer.Add(self.handbtn,         pos=(0,1),  span=(1,1), border=0)
        self.sizer.Add(self.zoombtn,         pos=(0,2),  span=(1,1), border=0)
        self.sizer.Add(self.trashbtn,        pos=(0,3),  span=(1,1), border=0)
        
        
        
        self.SetSizerAndFit(self.sizer)
        self.sizer.Layout()
        #self.plot.Update([0., 0.], xLabel="Time (minutes)", yLabel="HEG ratio", title=os.path.basename(path))
        self.running = 0
        self.status = 0
        self.path = path
    
        # Intercept mouse events for zooming to trigger text updates
        # We have to catch the events where they're generated, or else they
        # get handled in plot.PlotCanvas.
        self.plot.canvas.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.plot.canvas.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        #self.plot.Bind(wx.EVT_MOTION, self.OnMotion)
        self.plot.canvas.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseDoubleClick)
        self.plot.canvas.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseRightDown)