Changeset 71

Show
Ignore:
Timestamp:
03/04/04 11:37:46 (4 years ago)
Author:
ug
Message:

onlyOneMouseButton option; typo in option menu

Files:

Legend:

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

    r70 r71  
    115115     
    116116    def __init__(self, master, boardSize, canvasSize, fuzzy, labelFontsize, fixedColor, smartFixedColor, 
    117                  boardImg, blackImg, whiteImg): 
     117                 boardImg, blackImg, whiteImg, onlyOneMouseButton = 0): 
    118118        Board.__init__(self, master, boardSize, canvasSize, fuzzy, labelFontsize, 1, None, 
    119119                       boardImg, blackImg, whiteImg) 
     
    126126        self.smartFixedColor = smartFixedColor 
    127127 
    128 #        self.boundM2_1 = self.bind('<M2-Button-1>', self.selStart) 
    129 #        self.boundM2_1m = self.bind('<M2-B1-Motion>', self.selDrag) 
    130         self.bound3 = self.bind('<Button-3>', self.selStart) 
    131         self.bound3m = self.bind('<B3-Motion>', self.selDrag) 
     128        self.onlyOneMouseButton = onlyOneMouseButton 
     129        if onlyOneMouseButton: 
     130            self.bound3 = self.bind('<M2-Button-1>', self.selStart) 
     131            self.bound3m = self.bind('<M2-B1-Motion>', self.selDrag) 
     132        else: 
     133            self.bound3 = self.bind('<Button-3>', self.selStart) 
     134            self.bound3m = self.bind('<B3-Motion>', self.selDrag) 
    132135 
    133136        self.bounds1 = self.bind('<Shift-1>', self.wildcard) 
    134137 
    135138        self.invertSelection = IntVar() 
     139 
     140 
     141    def rebindMouseButtons(self, onlyOneMouseButton): 
     142        if self.onlyOneMouseButton: 
     143            self.unbind('<M2-B1-Motion>', self.bound3m) 
     144            self.unbind('<M2-Button-1>', self.bound3) 
     145        else: 
     146            self.unbind('<B3-Motion>', self.bound3m) 
     147            self.unbind('<3>', self.bound3) 
     148        self.onlyOneMouseButton = onlyOneMouseButton 
     149        if onlyOneMouseButton: 
     150            self.bound3 = self.bind('<M2-Button-1>', self.selStart) 
     151            self.bound3m = self.bind('<M2-B1-Motion>', self.selDrag) 
     152        else: 
     153            self.bound3 = self.bind('<Button-3>', self.selStart) 
     154            self.bound3m = self.bind('<B3-Motion>', self.selDrag) 
    136155 
    137156 
     
    10141033        b.update_idletasks() 
    10151034        b.bound1 = b.bind('<1>', lambda event, self=self, l=len(self.data): self.click(l)) 
    1016         b.unbind('<B3-Motion>', b.bound3m) 
    1017         b.unbind('<3>', b.bound3) 
    1018 #        b.unbind('<M2-Button-1>', b.boundM2_1) 
    1019 #        b.unbind('<M2-B1-Motion>', b.boundM2_1m) 
     1035 
     1036        if b.onlyOneMouseButton: 
     1037            b.unbind('<M2-B1-Motion>', b.bound3m) 
     1038            b.unbind('<M2-Button-1>', b.bound3) 
     1039        else: 
     1040            b.unbind('<B3-Motion>', b.bound3m) 
     1041            b.unbind('<3>', b.bound3) 
    10201042        b.unbind('<Configure>', b.boundConf) 
    10211043        b.bound3 = b.bind('<3>', lambda event, self=self, l = len(self.data): self.postMenu(event, l)) 
     
    59966018 
    59976019 
     6020    def rebindMouseButtons(self): 
     6021        self.board.rebindMouseButtons(self.options.onlyOneMouseButton.get()) 
     6022 
     6023 
     6024 
     6025 
    59986026    def initMenus(self): 
    59996027        """ Initialize the menus, and a few options variables. """ 
     
    61716199        advOptMenu.add_checkbutton(label='Do not change window title', 
    61726200                                   variable=self.options.doNotChangeWindowTitle) 
     6201 
     6202        self.options.onlyOneMouseButton = IntVar() 
     6203        advOptMenu.add_checkbutton(label='Only one mouse button', 
     6204                                   variable=self.options.onlyOneMouseButton, 
     6205                                   command=self.rebindMouseButtons) 
    61736206 
    61746207        advOptMenu.add_command(label='Customize appearance', underline=0, 
  • 05/devel/v.py

    r70 r71  
    28002800 
    28012801        self.options.confirmDelete = IntVar() 
    2802         self.optionsmenu.add_checkbutton(label='Ask for confirmation before deleting file', 
     2802        self.optionsmenu.add_checkbutton(label='Ask before discarding unsaved changes', 
    28032803                                         variable = self.options.confirmDelete) 
    28042804