Skip to content

Commit

Permalink
Merge pull request #5 from stephenmcd/master
Browse files Browse the repository at this point in the history
Add a cancel button on test discovery failure, so we can cleanly abort
  • Loading branch information
freakboy3742 committed Jul 8, 2013
2 parents 3b41f47 + fca2be0 commit 704d98d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cricket/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ def _show_test_errors(self, content):


class StackTraceDialog(Toplevel):
def __init__(self, parent, title, label, trace, button_text='OK'):
def __init__(self, parent, title, label, trace, button_text='OK',
cancel_text='Cancel'):
'''Show a dialog with a scrollable stack trace.
Arguments:
Expand Down Expand Up @@ -836,10 +837,10 @@ def __init__(self, parent, title, label, trace, button_text='OK'):
self.label.grid(column=0, row=0, padx=5, pady=5, sticky=(W, E))

self.description = ReadOnlyText(self.frame, width=80, height=20)
self.description.grid(column=0, row=1, pady=5, sticky=(N, S, E, W,))
self.description.grid(column=0, columnspan=2, row=1, pady=5, sticky=(N, S, E, W,))

self.description_scrollbar = Scrollbar(self.frame, orient=VERTICAL)
self.description_scrollbar.grid(column=1, row=1, pady=5, sticky=(N, S))
self.description_scrollbar.grid(column=1, row=1, pady=5, sticky=(N, S, E))
self.description.config(yscrollcommand=self.description_scrollbar.set)
self.description_scrollbar.config(command=self.description.yview)

Expand All @@ -848,6 +849,9 @@ def __init__(self, parent, title, label, trace, button_text='OK'):
self.ok_button = Button(self.frame, text=button_text, command=self.ok, default=ACTIVE)
self.ok_button.grid(column=0, row=2, padx=5, pady=5, sticky=(E,))

self.cancel_button = Button(self.frame, text=cancel_text, command=self.cancel)
self.cancel_button.grid(column=1, row=2, padx=5, pady=5, sticky=(E,))

self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)

Expand Down Expand Up @@ -923,5 +927,9 @@ def __init__(self, parent, trace):
'Error discovering test suite',
'The following stack trace was generated when attempting to discover the test suite:',
trace,
button_text='Retry'
button_text='Retry',
cancel_text='Quit',
)

def cancel(self, event=None):
self.parent.destroy()

0 comments on commit 704d98d

Please sign in to comment.