Changeset 132:92f78dc5b965 for src/mlx/gui
- Timestamp:
- 04/30/12 10:55:37 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r127 r132 33 33 DIALOG_MODAL = gtk.DIALOG_MODAL 34 34 WRAP_WORD = gtk.WRAP_WORD 35 JUSTIFY_CENTER = gtk.JUSTIFY_CENTER 35 36 36 37 def text2unicode(text): … … 59 60 DIALOG_MODAL = gtk.DialogFlags.MODAL 60 61 WRAP_WORD = gtk.WrapMode.WORD 62 JUSTIFY_CENTER = gtk.Justification.CENTER 61 63 62 64 import codecs -
src/mlx/gui/prefs.py
r131 r132 37 37 notebook.append_page(general, label) 38 38 39 messages = self._buildMessages() 40 label = gtk.Label(xstr("prefs_tab_messages")) 41 label.set_use_underline(True) 42 label.set_tooltip_text(xstr("prefs_tab_message_tooltip")) 43 notebook.append_page(messages, label) 44 39 45 advanced = self._buildAdvanced() 40 46 label = gtk.Label(xstr("prefs_tab_advanced")) … … 62 68 self._setLanguage(config.language) 63 69 self._flareTimeFromFS.set_active(config.flareTimeFromFS) 70 71 for messageType in const.messageTypes: 72 level = config.getMessageTypeLevel(messageType) 73 button = self._msgFSCheckButtons[messageType] 74 button.set_active(level == const.MESSAGELEVEL_FS or 75 level == const.MESSAGELEVEL_BOTH) 76 button = self._msgSoundCheckButtons[messageType] 77 button.set_active(level == const.MESSAGELEVEL_SOUND or 78 level == const.MESSAGELEVEL_BOTH) 64 79 65 80 self._togglingAutoUpdate = True … … 75 90 config.language = self._getLanguage() 76 91 config.flareTimeFromFS = self._flareTimeFromFS.get_active() 92 93 for messageType in const.messageTypes: 94 fsButtonActive = self._msgFSCheckButtons[messageType].get_active() 95 soundButtonActive = self._msgSoundCheckButtons[messageType].get_active() 96 if fsButtonActive: 97 level = const.MESSAGELEVEL_BOTH if soundButtonActive \ 98 else const.MESSAGELEVEL_FS 99 elif soundButtonActive: 100 level = const.MESSAGELEVEL_SOUND 101 else: 102 level = const.MESSAGELEVEL_NONE 103 config.setMessageTypeLevel(messageType, level) 104 77 105 config.autoUpdate = self._autoUpdate.get_active() 78 106 config.updateURL = self._updateURL.get_text() … … 155 183 self._warnedRestartNeeded = True 156 184 185 def _buildMessages(self): 186 """Build the page for the message settings.""" 187 188 mainAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, 189 xscale = 0.0, yscale = 0.0) 190 mainAlignment.set_padding(padding_top = 16, padding_bottom = 8, 191 padding_left = 4, padding_right = 4) 192 mainBox = gtk.VBox() 193 mainAlignment.add(mainBox) 194 195 table = gtk.Table(len(const.messageTypes) + 1, 3) 196 table.set_row_spacings(8) 197 table.set_col_spacings(32) 198 table.set_homogeneous(False) 199 mainBox.pack_start(table, False, False, 4) 200 201 label = gtk.Label(xstr("prefs_msgs_fs")) 202 label.set_justify(JUSTIFY_CENTER) 203 label.set_alignment(0.5, 1.0) 204 table.attach(label, 1, 2, 0, 1) 205 206 label = gtk.Label(xstr("prefs_msgs_sound")) 207 label.set_justify(JUSTIFY_CENTER) 208 label.set_alignment(0.5, 1.0) 209 table.attach(label, 2, 3, 0, 1) 210 211 self._msgFSCheckButtons = {} 212 self._msgSoundCheckButtons = {} 213 row = 1 214 for messageType in const.messageTypes: 215 messageTypeStr = const.messageType2string(messageType) 216 label = gtk.Label(xstr("prefs_msgs_type_" + messageTypeStr)) 217 label.set_justify(JUSTIFY_CENTER) 218 label.set_use_underline(True) 219 label.set_alignment(0.5, 0.5) 220 table.attach(label, 0, 1, row, row+1) 221 222 fsCheckButton = gtk.CheckButton() 223 alignment = gtk.Alignment(xscale = 0.0, yscale = 0.0, 224 xalign = 0.5, yalign = 0.5) 225 alignment.add(fsCheckButton) 226 table.attach(alignment, 1, 2, row, row+1) 227 self._msgFSCheckButtons[messageType] = fsCheckButton 228 229 soundCheckButton = gtk.CheckButton() 230 alignment = gtk.Alignment(xscale = 0.0, yscale = 0.0, 231 xalign = 0.5, yalign = 0.5) 232 alignment.add(soundCheckButton) 233 table.attach(alignment, 2, 3, row, row+1) 234 self._msgSoundCheckButtons[messageType] = soundCheckButton 235 236 mnemonicWidget = gtk.Label("") 237 table.attach(mnemonicWidget, 3, 4, row, row+1) 238 label.set_mnemonic_widget(mnemonicWidget) 239 mnemonicWidget.connect("mnemonic-activate", 240 self._msgLabelActivated, 241 messageType) 242 243 row += 1 244 245 return mainAlignment 246 247 def _msgLabelActivated(self, button, cycle_group, messageType): 248 """Called when the mnemonic of a label is activated. 249 250 It cycles the corresponding options.""" 251 fsCheckButton = self._msgFSCheckButtons[messageType] 252 soundCheckButton = self._msgSoundCheckButtons[messageType] 253 254 num = 1 if fsCheckButton.get_active() else 0 255 num += 2 if soundCheckButton.get_active() else 0 256 num += 1 257 258 fsCheckButton.set_active((num&0x01)==0x01) 259 soundCheckButton.set_active((num&0x02)==0x02) 260 261 return True 262 157 263 def _buildAdvanced(self): 158 264 """Build the page for the advanced settings."""
Note:
See TracChangeset
for help on using the changeset viewer.