Changeset 70

Show
Ignore:
Timestamp:
03/03/04 22:42:28 (5 years ago)
Author:
ug
Message:

New option: show last move (cf. Bernd Schmidt's patch).
New option: ask for confirmation befor deleting file with unsaved changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 05/devel/board1.py

    r42 r70  
    417417        return (x,y)     
    418418 
    419     def placeMark(self, pos, color): 
     419    def placeMark(self, pos, color, outln='', size=''): 
    420420        """ Place colored mark at pos. """ 
    421421        x1, x2, y1, y2 = self.getPixelCoord(pos, 1) 
    422         self.create_oval(x1+2, x2+2, y1-2, y2-2, fill = color, tags=('marks','non-bg')) 
     422 
     423        if size == 'small': 
     424            tmp1 = (y1 - x1) * 1 / 5 
     425            tmp2 = (y2 - x2) * 1 / 5 
     426        else: 
     427            tmp1 = 2 
     428            tmp2 = 2 
     429        self.create_oval(x1+tmp1, x2+tmp2, y1-tmp1, y2-tmp2, fill = color, 
     430                         outline = outln, tags=('marks', 'non-bg')) 
    423431        self.marks[pos]=color 
    424432        self.onChange() 
  • 05/devel/kombilo.py

    r69 r70  
    47124712    def delFile(self): 
    47134713        self.prevSearches.deleteFile(self.cursor) 
    4714         v.Viewer.delFile(self) 
     4714        return v.Viewer.delFile(self) 
    47154715 
    47164716 
     
    58265826                                           
    58275827    def quit(self): 
     5828        self.changeCurrentFile(None, 0) 
     5829        for i in range(len(self.filelist)): 
     5830            if not self.delFile(): return 
     5831         
    58285832        self.saveOptions() 
    58295833        try: 
  • 05/devel/v.py

    r67 r70  
    14221422        """ Mark all variations for the next move. """ 
    14231423 
    1424         if not self.cursor or self.cursor.atEnd: return 
     1424        if not self.cursor: return 
    14251425         
    14261426        passV = 0 
    14271427 
    14281428        try: 
     1429            if self.options.showCurrMoveVar.get(): 
     1430                c = self.cursor.currentNode() 
     1431                for color in ['B', 'W']: 
     1432                    if c.has_key(color) and c[color][0] and self.convCoord(c[color][0]): 
     1433                        if color == 'B': self.board.placeMark(self.convCoord(c[color][0]),'', 'white', 'small') 
     1434                        else: self.board.placeMark(self.convCoord(c[color][0]), '', 'black', 'small') 
     1435 
     1436            if self.cursor.atEnd: return 
    14291437         
    14301438            for i in range(self.cursor.noChildren()): 
     
    14351443                        if c[color][0] and self.convCoord(c[color][0]): 
    14361444                            if self.options.showNextMoveVar.get(): 
    1437                                 self.board.placeMark(self.convCoord(c[color][0]),''
     1445                                self.board.placeMark(self.convCoord(c[color][0]),'', 'black'
    14381446                        else: 
    14391447                            passV = 1 
     
    14571465    def showNextMove(self): 
    14581466        """ Toggle 'show next move' option. """ 
    1459         if self.options.showNextMoveVar.get(): 
    1460             self.markAll() 
    1461         else: 
    1462             self.board.delMarks() 
     1467 
     1468        self.board.delMarks() 
     1469        self.markAll() 
     1470         
    14631471 
    14641472    def passFct(self): 
     
    17341742                    self.moveno.set(str(int(self.moveno.get())+1)) 
    17351743 
    1736                     self.markAll() 
    17371744                    self.displayNode(c) 
    17381745                    if c.has_key('B'): 
     
    17831790 
    17841791            self.currentFileChanged() 
     1792 
     1793        self.markAll() 
    17851794                     
    17861795        return done 
     
    18531862            self.capVar.set('Cap - B: ' + str(self.capB) + ', W: ' + str(self.capW)) 
    18541863 
    1855             if not self.cursor.atEnd: self.markAll() 
     1864            self.markAll() 
    18561865 
    18571866            if self.board.currentColor == 'black': 
     
    22762285        index = int(self.dataWindow.filelist.list.curselection()[0]) 
    22772286 
     2287        s = self.dataWindow.filelist.list.get(index) 
     2288        if self.options.confirmDelete.get() and s[0:2] == '* ': 
     2289            if not askokcancel('Confirm deletion', 'There are unsaved changes. Delete?'): 
     2290                return 
     2291 
    22782292        del self.filelist[index] 
    22792293 
     
    22862300            self.currentFileNum = -2 
    22872301            self.newFile() 
    2288             return 
     2302            return 1 
    22892303         
    22902304        self.currentFileNum = -1 
    22912305        self.changeCurrentFile(None, index) 
    22922306 
     2307        return 1 
    22932308         
    22942309    def modeChange(self): 
     
    24662481    def quit(self): 
    24672482        """ Exit the program. """ 
     2483 
     2484        self.changeCurrentFile(None, 0) 
     2485        for i in range(len(self.filelist)): 
     2486            if not self.delFile(): return 
     2487             
    24682488        self.saveOptions() 
    24692489        self.dataWindow.window.destroy() 
     
    27692789                                         command = self.showNextMove) 
    27702790 
     2791        self.options.showCurrMoveVar = IntVar() 
     2792        self.optionsmenu.add_checkbutton(label='Show last move', underline=5, 
     2793                                         variable = self.options.showCurrMoveVar, 
     2794                                         command = self.showNextMove) 
     2795 
    27712796        self.options.showCoordinates = IntVar() 
    27722797        self.optionsmenu.add_checkbutton(label='Show coordinates', 
    27732798                                         variable = self.options.showCoordinates, 
    27742799                                         command = self.toggleCoordinates) 
     2800 
     2801        self.options.confirmDelete = IntVar() 
     2802        self.optionsmenu.add_checkbutton(label='Ask for confirmation before deleting file', 
     2803                                         variable = self.options.confirmDelete) 
     2804                                          
    27752805 
    27762806        self.helpmenu = Menu(menu, name='help')