Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 34 | magnus | 1 | Author: Magnus Holmgren <holmgren@debian.org> |
| 2 | Description: Improve the code for adding new entries to the Additional Hosts list |
||
| 3 | - Fix C&P bug that caused the Game port to be validated twice but the Web port not at all. |
||
| 4 | - Pre-fill the default ports. |
||
| 5 | - Don't destroy the dialog until the entered values have been extracted. |
||
| 6 | |||
| 7 | --- a/pyscrabble/gui/options.py |
||
| 8 | +++ b/pyscrabble/gui/options.py |
||
| 9 | @@ -830,10 +830,12 @@ class OptionWindow(gtk.Window): |
||
| 10 | |||
| 11 | s = _("Game port") |
||
| 12 | gport = gtkutil.EntryWithLabel(label="%s: " % s, visibility=True) |
||
| 13 | + gport.set_text("9999") |
||
| 14 | dialog.vbox.pack_start( gport ) |
||
| 15 | |||
| 16 | s = _("Web port") |
||
| 17 | wport = gtkutil.EntryWithLabel(label="%s: " % s, visibility=True) |
||
| 18 | + wport.set_text("8888") |
||
| 19 | dialog.vbox.pack_start( wport ) |
||
| 20 | |||
| 21 | s = _("Location") |
||
| 22 | @@ -866,13 +868,11 @@ class OptionWindow(gtk.Window): |
||
| 23 | |||
| 24 | try: |
||
| 25 | int(gport.get_text()) |
||
| 26 | - int(gport.get_text()) |
||
| 27 | + int(wport.get_text()) |
||
| 28 | except: |
||
| 29 | self.error(util.ErrorMessage(_('Port must be a number'))) |
||
| 30 | return |
||
| 31 | |||
| 32 | - dialog.destroy() |
||
| 33 | - |
||
| 34 | o = manager.OptionManager(section=HOSTS_SECTION) |
||
| 35 | data = o.get_default_option(OPTION_HOSTS, '') |
||
| 36 | data = '%s%s:%s:%s:%s/' % (data, host.get_text(), gport.get_text(), wport.get_text(), location.get_text()) |
||
| 37 | @@ -882,4 +882,5 @@ class OptionWindow(gtk.Window): |
||
| 38 | model.clear() |
||
| 39 | for host,gport,wport,location in util.getAdditionalHosts(): |
||
| 40 | model.append( (host,location) ) |
||
| 41 | - |
||
| 42 | \ No newline at end of file |
||
| 43 | + |
||
| 44 | + dialog.destroy() |