예제 #1
0
 def Init(self, year, panel):
     '''Loads the correct html file to the panel.'''
     path = X_utilities.yearDirFP(year=year)
     file = 'panel_'+unicode(panel)+'_y'+unicode(year)+'.html'
     path = os.path.join(path, file)
     if os.path.isfile(path):
         self.html_display.LoadFile(path)
     else:
         wx.MessageBox(self.noFileMsg, self.noFileCap)
예제 #2
0
    def Init(self, year, lessonNum, lessonTitle):
        '''Sets up the panel with the correct title and loads the correct
        video.'''
        # Set up the video information
        self.year_st.SetLabel(self.year_lbl + ' ' + year)
        self.lesson_st.SetLabel(self.lesson_lbl + ' ' + unicode(lessonNum))
        self.lessonTitle_st.SetLabel(lessonTitle)
        # Get the correct video path:
        path = X_utilities.yearDirFP(int(year))
        file = 'LessonVid_y'+year+'_'+unicode(lessonNum)+'.mov'
        vidFile = os.path.join(path, file)
        
        # CHECK 1: LOAD FROM HDD
        #------------------------------------------------------------------
        if os.path.isfile(vidFile):
            # FOR LITE VERSION ONLY -- LOAD STRAIGHT FROM INTERNET
            self.vidPlayer.LoadFile(vidFile)
            return 1
        
        
        # IF LOAD FROM HDD FAIL => DLG: SELECT FILE LOCATION or YOUTUBE
        else:
#            busy = wx.BusyInfo(self.searching_lbl+'...')
            
            # Check the internet connection -------------------------------
            self.inet_connected = True
            try:
                urllib2.urlopen("http://google.com", timeout=2)
            except urllib2.URLError:
                self.inet_connected = False
                return 0
#                path = self.OpenFile(file)
#                if path:
#                    self.vidPlayer.LoadFile(path)
#                    return 1
#                else:
#                    return 2
            finally:
                busy=None
                
            # TEMPORARY - FOR LITE VERSION ONLY
            self.OpenURL(year, lessonNum)
            return 2