Changeset 46:43e46847479a for src/mlx/gui/flight.py
- Timestamp:
- 03/18/12 19:18:36 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r45 r46 17 17 self.add(frame) 18 18 19 print self.get_style()20 19 style = self.get_style() if pygobject else self.rc_get_style() 21 20 … … 56 55 57 56 self._buttonBox = gtk.HButtonBox() 57 self._defaultButton = None 58 58 buttonAlignment.add(self._buttonBox) 59 59 … … 66 66 self._mainAlignment.add(widget) 67 67 68 def addButton(self, label ):68 def addButton(self, label, default = False): 69 69 """Add a button with the given label. 70 70 … … 72 72 button = gtk.Button(label) 73 73 self._buttonBox.add(button) 74 if default: 75 button.set_can_default(True) 76 self._defaultButton = button 74 77 return button 75 78 79 def grabDefault(self): 80 """If the page has a default button, make it the default one.""" 81 if self._defaultButton is not None: 82 self._defaultButton.grab_default() 83 76 84 #----------------------------------------------------------------------------- 77 85 … … 128 136 table.attach(self._rememberButton, 1, 2, 2, 3, ypadding = 8) 129 137 130 self._loginButton = self.addButton("_Login" )138 self._loginButton = self.addButton("_Login", default = True) 131 139 self._loginButton.set_sensitive(False) 132 140 self._loginButton.set_use_underline(True) … … 232 240 """Go to the next page.""" 233 241 self.setCurrentPage(self._currentPage + 1) 242 243 def grabDefault(self): 244 """Make the default button of the current page the default.""" 245 self._pages[self._currentPage].grabDefault() 234 246 235 247 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.