Logo Search packages:      
Sourcecode: uligo version File versions  Download package

def uligo::PbmRecord::__init__ (   self,
  path,
  filename,
  noOfPbms,
  defMode 
)

defMode is a Tk IntVar which stores the mode for choosing the order of the problems.
    0 = random, 1 = sequential (change .dat to keep track of correct/wrong answers),
    2 = sequential, don't change .dat file 

Definition at line 189 of file uligo.py.

00189                                                          :
        """ defMode is a Tk IntVar which stores the mode for choosing the order of the problems.
            0 = random, 1 = sequential (change .dat to keep track of correct/wrong answers),
            2 = sequential, don't change .dat file """
        
        self.modeVar = IntVar()
        self.defModeVar = defMode
        
        if filename[-4:] == '.sgf': self.filename = filename[:-4] + '.dat'
        else:                       self.filename = filename + '.dat'

        self.path = path

        self.history = [] # list of pbms asked in this session, for the "back" button

        try:
            f = open(os.path.join(self.path,self.filename))
            s = f.readline();
            if s == 'uligo01\n':            # this is a .dat file from uligo 0.1 or 0.2
                f.seek(0)
                self.noOfPbms, self.pbmsAsked, self.noRight, self.noWrong, self.list = pickle.load(f)
                f.close()
                self.modeVar.set(defMode.get())
                self.current = -1
                self.handleCurrent = -1
            else:
                self.noOfPbms, self.pbmsAsked, self.noRight, self.noWrong, \
                               self.current, self.handleCurrent, help, self.list = pickle.load(f)
                self.modeVar.set(help)
        except IOError:
            # create new list:
          
            self.noOfPbms = noOfPbms
            self.pbmsAsked = 0
            self.noRight = self.noWrong = 0
            self.modeVar.set(defMode.get())
            self.current = -1
            self.handleCurrent = -1
            
            self.list = []
            
            for i in range(noOfPbms):
                self.list.append((i, 0, -1, 0, 0)) # no of corresp problem, no. asked, 
                                                   # when asked for last time (this is not evaluated directly),
                                                   # no. right answers, no. wrong answers 


    def getNext(self):


Generated by  Doxygen 1.6.0   Back to index