Changeset 149:aab353620d1c for src/mlx
- Timestamp:
- 05/04/12 17:53:57 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/config.py
r148 r149 42 42 self._flareTimeFromFS = False 43 43 self._syncFSTime = False 44 45 self._pirepDirectory = None 44 46 45 47 self._autoUpdate = True … … 160 162 if syncFSTime!=self._syncFSTime: 161 163 self._syncFSTime = syncFSTime 164 self._modified = True 165 166 @property 167 def pirepDirectory(self): 168 """Get the directory offered by default when saving a PIREP.""" 169 return self._pirepDirectory 170 171 @pirepDirectory.setter 172 def pirepDirectory(self, pirepDirectory): 173 """Get the directory offered by default when saving a PIREP.""" 174 if pirepDirectory!=self._pirepDirectory and \ 175 (pirepDirectory!="" or self._pirepDirectory is not None): 176 self._pirepDirectory = None if pirepDirectory=="" \ 177 else pirepDirectory 162 178 self._modified = True 163 179 … … 231 247 "syncFSTime", 232 248 False) 249 self._pirepDirectory = self._get(config, "general", 250 "pirepDirectory", None) 233 251 234 252 self._messageTypeLevels = {} … … 269 287 config.set("general", "syncFSTime", 270 288 "yes" if self._syncFSTime else "no") 289 290 if self._pirepDirectory is not None: 291 config.set("general", "pirepDirectory", self._pirepDirectory) 271 292 272 293 config.add_section(Config._messageTypesSection) -
src/mlx/gui/common.py
r144 r149 29 29 RESPONSETYPE_ACCEPT = gtk.RESPONSE_ACCEPT 30 30 RESPONSETYPE_REJECT = gtk.RESPONSE_REJECT 31 RESPONSETYPE_CANCEL = gtk.RESPONSE_CANCEL 31 32 ACCEL_VISIBLE = gtk.ACCEL_VISIBLE 32 33 CONTROL_MASK = gdk.CONTROL_MASK … … 43 44 44 45 SPIN_USER_DEFINED = gtk.SPIN_USER_DEFINED 46 47 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER 45 48 46 49 def text2unicode(text): … … 65 68 RESPONSETYPE_ACCEPT = gtk.ResponseType.ACCEPT 66 69 RESPONSETYPE_REJECT = gtk.ResponseType.REJECT 70 RESPONSETYPE_CANCEL = gtk.ResponseType.CANCEL 67 71 ACCEL_VISIBLE = gtk.AccelFlags.VISIBLE 68 72 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK … … 79 83 80 84 SPIN_USER_DEFINED = gtk.SpinType.USER_DEFINED 85 86 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FileChooserAction.SELECT_FOLDER 81 87 82 88 import codecs -
src/mlx/gui/prefs.py
r148 r149 73 73 self._syncFSTime.set_active(config.syncFSTime) 74 74 75 pirepDirectory = config.pirepDirectory 76 self._pirepDirectory.set_text("" if pirepDirectory is None 77 else pirepDirectory) 78 75 79 for messageType in const.messageTypes: 76 80 level = config.getMessageTypeLevel(messageType) … … 98 102 config.flareTimeFromFS = self._flareTimeFromFS.get_active() 99 103 config.syncFSTime = self._syncFSTime.get_active() 104 config.pirepDirectory = self._pirepDirectory.get_text() 100 105 101 106 for messageType in const.messageTypes: … … 117 122 """Build the page for the general settings.""" 118 123 mainAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, 119 xscale = 0.0, yscale = 0.0)120 mainAlignment.set_padding(padding_top = 16, padding_bottom = 32,121 padding_left = 4, padding_right = 4 8)124 xscale = 1.0, yscale = 0.0) 125 mainAlignment.set_padding(padding_top = 16, padding_bottom = 8, 126 padding_left = 4, padding_right = 4) 122 127 mainBox = gtk.VBox() 123 128 mainAlignment.add(mainBox) … … 174 179 self._syncFSTime.set_tooltip_text(xstr("prefs_syncFSTime_tooltip")) 175 180 mainBox.pack_start(self._syncFSTime, False, False, 4) 176 181 182 pirepBox = gtk.HBox() 183 mainBox.pack_start(pirepBox, False, False, 4) 184 185 label = gtk.Label(xstr("prefs_pirepDirectory")) 186 label.set_use_underline(True) 187 pirepBox.pack_start(label, False, False, 4) 188 189 self._pirepDirectory = gtk.Entry() 190 self._pirepDirectory.set_tooltip_text(xstr("prefs_pirepDirectory_tooltip")) 191 label.set_mnemonic_widget(self._pirepDirectory) 192 pirepBox.pack_start(self._pirepDirectory, True, True, 4) 193 194 self._pirepDirectoryButton = gtk.Button(xstr("button_browse")) 195 self._pirepDirectoryButton.connect("clicked", 196 self._pirepDirectoryButtonClicked) 197 pirepBox.pack_start(self._pirepDirectoryButton, False, False, 4) 198 177 199 return mainAlignment 178 200 … … 209 231 dialog.hide() 210 232 self._warnedRestartNeeded = True 211 233 234 def _pirepDirectoryButtonClicked(self, button): 235 """Called when the PIREP directory button is clicked.""" 236 dialog = gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 237 xstr("prefs_pirepDirectory_browser_title"), 238 action = FILE_CHOOSER_ACTION_SELECT_FOLDER, 239 buttons = (gtk.STOCK_CANCEL, RESPONSETYPE_CANCEL, 240 gtk.STOCK_OK, RESPONSETYPE_OK)) 241 242 directory = self._pirepDirectory.get_text() 243 if directory: 244 dialog.select_filename(directory) 245 246 result = dialog.run() 247 dialog.hide() 248 249 if result==RESPONSETYPE_OK: 250 self._pirepDirectory.set_text(dialog.get_filename()) 251 212 252 def _buildMessages(self): 213 253 """Build the page for the message settings.""" … … 292 332 293 333 mainAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, 294 xscale = 0.0, yscale = 0.0)295 mainAlignment.set_padding(padding_top = 16, padding_bottom = 32,296 padding_left = 4, padding_right = 4 8)334 xscale = 1.0, yscale = 0.0) 335 mainAlignment.set_padding(padding_top = 16, padding_bottom = 8, 336 padding_left = 4, padding_right = 4) 297 337 mainBox = gtk.VBox() 298 338 mainAlignment.add(mainBox) … … 318 358 self._updateURL.set_tooltip_text(xstr("prefs_update_url_tooltip")) 319 359 self._updateURL.connect("changed", self._updateURLChanged) 320 updateURLBox.pack_start(self._updateURL, False, False, 4)360 updateURLBox.pack_start(self._updateURL, True, True, 4) 321 361 322 362 return mainAlignment … … 350 390 """Called when the update URL is changed.""" 351 391 self._setOKButtonSensitivity() 352 353 -
src/mlx/i18n.py
r148 r149 128 128 self.add("button_yes", "_Yes") 129 129 self.add("button_no", "_No") 130 self.add("button_browse", "Browse...") 130 131 131 132 self.add("menu_file", "File") … … 621 622 "If this is checked the flight simulator's internal clock " 622 623 "will always be synchronized to the computer's clock.") 624 self.add("prefs_pirepDirectory", 625 "_PIREP directory:") 626 self.add("prefs_pirepDirectory_tooltip", 627 "The directory that will be offered by default when " 628 "saving a PIREP.") 629 self.add("prefs_pirepDirectory_browser_title", 630 "Select PIREP directory") 623 631 self.add("prefs_update_auto", "Update the program auto_matically") 624 632 self.add("prefs_update_auto_tooltip", … … 671 679 self.add("button_yes", "_Igen") 672 680 self.add("button_no", "_Nem") 681 self.add("button_browse", "Keresés...") 673 682 674 683 self.add("menu_file", "Fájl") … … 1174 1183 "Ha ez bejelölöd, a szimulátor belső óráját a program " 1175 1184 "szinkronban tartja a számítógép órájával.") 1185 self.add("prefs_pirepDirectory", 1186 "_PIREP-ek könyvtára:") 1187 self.add("prefs_pirepDirectory_tooltip", 1188 "Az itt megadott könyvtárt ajánlja majd fel a program " 1189 "a PIREP-ek mentésekor.") 1190 self.add("prefs_pirepDirectory_browser_title", 1191 "Válaszd ki a PIREP-ek könyvtárát") 1176 1192 self.add("prefs_update_auto", 1177 1193 "Frissítsd a programot _automatikusan")
Note:
See TracChangeset
for help on using the changeset viewer.