Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maddavo committed Feb 26, 2015
2 parents b2cea65 + fd635ae commit 5d387f8
Show file tree
Hide file tree
Showing 3 changed files with 3,458 additions and 3,074 deletions.
20 changes: 12 additions & 8 deletions commands/update_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,19 @@ def __init__(self, parent, tdb, tdenv):
parent.wm_attributes("-topmost", sticky)


def selectWidget(self, widget, newValue=None):
if newValue is not None:
widget.val.set(newValue)
widget.focus_set()
widget.selection_range(0, tk.END)


def focusOn(self, displayNo, pos):
""" Set focus to a widget and select the text in it """

row = self.itemDisplays[displayNo]
widget = row[pos][0]
widget.focus_set()
widget.selection_range(0, tk.END)
self.selectWidget(widget)


def setValue(self, row, pos, value):
Expand Down Expand Up @@ -230,8 +236,7 @@ def checkValueAgainstStats(self, widget, stats):
cr, minCr,
))
if not ok:
widget.val.set("")
widget.focus_set()
self.selectWidget(widget, "")
return False
widget.configure(bg = '#ff8080')

Expand All @@ -248,8 +253,7 @@ def checkValueAgainstStats(self, widget, stats):
cr, maxCr,
))
if not ok:
widget.val.set("")
widget.focus_set()
self.selectWidget(widget, "")
return False
widget.configure(bg = '#8080ff')

Expand Down Expand Up @@ -343,8 +347,7 @@ def validate(self, widget):
parent=widget,
)
if not ok:
widget.val.set("")
widget.focus_set()
self.selectWidget(widget, "")
return False

return True
Expand Down Expand Up @@ -373,6 +376,7 @@ def validate(self, widget):
"EXAMPLE: If the UI says '2341 LOW', type '2341L'.\n"
)
widget.val.set("?")
self.selectWidget(widget)
return False

return True
Expand Down
Loading

0 comments on commit 5d387f8

Please sign in to comment.