Changeset 72

Show
Ignore:
Timestamp:
03/04/04 12:06:02 (5 years ago)
Author:
ug
Message:

Option: ask before starting time consuming search

Files:

Legend:

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

    r71 r72  
    37073707                                        # finished 
    37083708 
     3709        stoneCount = 0 
     3710 
    37093711        for i in range(self.sel[0][1], self.sel[1][1]+1): 
    37103712            for j in range(self.sel[0][0], self.sel[1][0]+1): 
    37113713                if not self.board.status.has_key((j,i)): d[(i-1,j-1)] = '.' 
    3712                 elif self.board.status[(j,i)] == 'black': d[(i-1,j-1)] = 'X' 
    3713                 else:                                    d[(i-1,j-1)] = 'O' 
     3714                elif self.board.status[(j,i)] == 'black': 
     3715                    d[(i-1,j-1)] = 'X' 
     3716                    stoneCount += 1 
     3717                else: 
     3718                    d[(i-1,j-1)] = 'O' 
     3719                    stoneCount += 1 
    37143720                if self.board.wildcards.has_key((j,i)): d[(i-1,j-1)] = '*' 
    37153721 
     
    37393745            anchors = [(1, 1), (17-self.sel[1][1]+self.sel[0][1], 
    37403746                                17-self.sel[1][0]+self.sel[0][0])] 
     3747 
     3748            if self.options.askBeforeLongSearch.get() and \ 
     3749               ( (stoneCount <= 1) or \ 
     3750                 (stoneCount <= 2 and (self.sel[1][1]-self.sel[0][1]+1)*(self.sel[1][0]-self.sel[0][0]+1) < 30) or\ 
     3751                 (stoneCount <= 3 and (self.sel[1][1]-self.sel[0][1]+1)*(self.sel[1][0]-self.sel[0][0]+1) < 16) ): 
     3752                if not askokcancel('Time consuming search', 'This search may take quite some time. Continue?'): 
     3753                    return 
    37413754 
    37423755        self.currentSearchPattern = Pattern(anchors, d) 
     
    62046217                                   variable=self.options.onlyOneMouseButton, 
    62056218                                   command=self.rebindMouseButtons) 
     6219 
     6220        self.options.askBeforeLongSearch = IntVar() 
     6221        advOptMenu.add_checkbutton(label='Ask before time consuming search', 
     6222                                   variable=self.options.askBeforeLongSearch) 
    62066223 
    62076224        advOptMenu.add_command(label='Customize appearance', underline=0,