diff --git a/tkgui/child_windows.py b/tkgui/child_windows.py index a28cf33..d619fc6 100644 --- a/tkgui/child_windows.py +++ b/tkgui/child_windows.py @@ -308,7 +308,8 @@ def yes(self): class TerminalSelector(ChildWindow): """Used to select a terminal for launcing child programs on Linux.""" - def __init__(self, parent): + def __init__(self, parent, first_run): + self.first_run = first_run super(TerminalSelector, self).__init__(parent, 'Configure terminal') self.running_test = False self.running_status = '' @@ -319,13 +320,16 @@ def create_controls(self, container): Label(f, text='Please select which terminal should be used when ' 'launching programs requiring it (e.g. DFHack).').grid( column=0, row=0) - self.term = StringVar(self.parent) - cur = terminal.get_configured_terminal() - try: - self.term.set(cur.name) - except NameError: - pass terminals = [t.name for t in terminal.get_valid_terminals()] + self.term = StringVar(self.parent) + if self.first_run: + cur = terminals[0] + else: + try: + cur = terminal.get_configured_terminal().name + except NameError: + pass + self.term.set(cur) OptionMenu(f, self.term, self.term.get(), *terminals).grid( column=0, row=1) diff --git a/tkgui/tkgui.py b/tkgui/tkgui.py index 92e2669..396894e 100644 --- a/tkgui/tkgui.py +++ b/tkgui/tkgui.py @@ -141,7 +141,7 @@ def __init__(self): 'PyLNP', 'You need to configure a terminal to allow things like DFHack ' 'to work correctly. Press OK to do this now.') - self.configure_terminal() + self.configure_terminal(True) self.root.deiconify() root.option_add('*tearOff', FALSE) @@ -441,9 +441,12 @@ def reload_program(self): self.do_reload = True self.exit_program() - def configure_terminal(self): - """Configures the command used to launch a terminal on Linux.""" - TerminalSelector(self.root) + def configure_terminal(self, first_run=False): + """ + Configures the command used to launch a terminal on Linux. + If first_run is set, a terminal will be selected automatically. + """ + TerminalSelector(self.root, first_run) def configure_updates(self, days): """Sets the number of days until next update check."""