diff --git a/ffgo/config.py b/ffgo/config.py index e0f92cf..25f15ac 100644 --- a/ffgo/config.py +++ b/ffgo/config.py @@ -93,6 +93,7 @@ def __init__(self, master=None): self.showFGOutput = IntVar() self.showFGOutputInSeparateWindow = IntVar() self.FGOutputGeometry = StringVar() + self.autoscrollFGOutput = IntVar() self.keywords = {'--aircraft=': self.aircraft, '--airport=': self.airport, @@ -123,7 +124,8 @@ def __init__(self, master=None): 'SHOW_FG_OUTPUT=': self.showFGOutput, 'SHOW_FG_OUTPUT_IN_SEPARATE_WINDOW=': self.showFGOutputInSeparateWindow, - 'FG_OUTPUT_GEOMETRY=': self.FGOutputGeometry} + 'FG_OUTPUT_GEOMETRY=': self.FGOutputGeometry, + 'AUTOSCROLL_FG_OUTPUT=': self.autoscrollFGOutput} # In order to avoid using a lot of memory, detailed airport data is # only loaded on demand. Since this is quite slow, keep a cache of the @@ -340,6 +342,7 @@ def update(self, path=None, ignoreFGVersionError=False, logFGVersion=True): self.showFGOutput.set('1') self.showFGOutputInSeparateWindow.set('0') self.FGOutputGeometry.set('') + self.autoscrollFGOutput.set('1') self.park.set('') self.rwy.set('') self.scenario.set('') diff --git a/ffgo/data/config/presets b/ffgo/data/config/presets index 4817b77..e08a815 100644 --- a/ffgo/data/config/presets +++ b/ffgo/data/config/presets @@ -94,6 +94,10 @@ # - Window geometry specification for the # Output Window. Set this only if you are not # satisfied with the default window geometry. +# AUTOSCROLL_FG_OUTPUT=boolean - 0 or 1 (defaults to 1). Automatically scroll +# the Output Window to the end whenever new +# text is received from FlightGear's stdout or +# stderr stream. # # Any number of options can be selected, but to get FFGo ready to work, # you only need: diff --git a/ffgo/gui/configwindow.py b/ffgo/gui/configwindow.py index 0d38026..d24906b 100644 --- a/ffgo/gui/configwindow.py +++ b/ffgo/gui/configwindow.py @@ -303,6 +303,10 @@ def initToolTipMessages(self): When saving the configuration, don't store the main window size only, but also its position (i.e., the offsets from the screen borders). When this option is unchecked, only the main window size is stored.""") + self.tooltip_autoscrollFGOutput = _( + "Automatically scroll the FlightGear Output Window to the end " + "every time new text is received from FlightGear's stdout or " + "stderr stream.") def quit(self): """Quit without saving.""" @@ -620,9 +624,22 @@ def widgetMisc(self): self.MagneticFieldBinFind.pack(side='left') # “Remember main windows position” checkbox + self.frame_rememberMainWinPos = Frame(self.frame_misc) + self.frame_rememberMainWinPos.pack(side='top', fill='x', expand=True) self.rememberMainWinPos = Checkbutton( - self.frame_misc, + self.frame_rememberMainWinPos, text=_('Remember the main window position'), variable=self.config.saveWindowPosition) ToolTip(self.rememberMainWinPos, self.tooltip_rememberMainWinPos) self.rememberMainWinPos.pack(side='left', fill='x') + + # “Automatically scroll the Output Window” checkbox + self.frame_autoscrollFGOutput = Frame(self.frame_misc) + self.frame_autoscrollFGOutput.pack(side='top', fill='x', expand=True) + self.autoscrollFGOutput = Checkbutton( + self.frame_autoscrollFGOutput, + text=_('Automatically scroll the Output Window'), + variable=self.config.autoscrollFGOutput) + ToolTip(self.autoscrollFGOutput, self.tooltip_autoscrollFGOutput, + autowrap=True) + self.autoscrollFGOutput.pack(side='left', fill='x') diff --git a/ffgo/gui/mainwindow.py b/ffgo/gui/mainwindow.py index 357afb9..1f8c881 100644 --- a/ffgo/gui/mainwindow.py +++ b/ffgo/gui/mainwindow.py @@ -1549,7 +1549,9 @@ def _updateFgfsProcessOutput(self, event, queue=None): self.FGOutput.appendNoUnlock(line) self.FGOutput.lock() - self.FGOutput.showEnd() + + if self.config.autoscrollFGOutput.get(): + self.FGOutput.showEnd() def _onFgfsProcessTerminated(self, event, queue=None): # There should be exactly one item in the queue now. Get it.