def input(self, args, key): """Handle user input. Numbers are used to show a spoke, the rest is passed to the higher level for processing.""" if self._container.process_user_input(key): return InputState.PROCESSED else: # If we get a continue, check for unfinished spokes. If unfinished # don't continue # TRANSLATORS: 'c' to continue if key == Prompt.CONTINUE: for spoke in self._spokes.values(): if not spoke.completed and spoke.mandatory: print( _("Please complete all spokes before continuing")) return InputState.DISCARDED # TRANSLATORS: 'h' to help elif key == Prompt.HELP: if self.has_help: help_path = ihelp.get_help_path(self.helpFile, self.instclass, True) ScreenHandler.push_screen_modal(HelpScreen(help_path)) self.redraw() return InputState.PROCESSED return key
def input(self, args, key): """Handle the input.""" if key.lower() == Prompt.HELP: help_path = self._get_help() if help_path: ScreenHandler.push_screen_modal(HelpScreen(help_path)) return InputState.PROCESSED_AND_REDRAW return super().input(args, key)
def input(self, args, key): """Handle the input.""" # TRANSLATORS: 'h' to help if key.lower() == Prompt.HELP: if self.has_help: help_path = ihelp.get_help_path(self.helpFile, True) ScreenHandler.push_screen_modal(HelpScreen(help_path)) return InputState.PROCESSED_AND_REDRAW return super().input(args, key)
def input(self, args, key): """Handle the input.""" # TRANSLATORS: 'h' to help if key.lower() == Prompt.HELP: if self.has_help: help_path = ihelp.get_help_path(self.helpFile, self.instclass, True) ScreenHandler.push_screen_modal(HelpScreen(help_path)) self.redraw() return InputState.PROCESSED return super(NormalTUISpoke, self).input(args, key)
def input(self, args, key): """Handle user input. Numbers are used to show a spoke, the rest is passed to the higher level for processing.""" if self._container.process_user_input(key): return InputState.PROCESSED else: # If we get a continue, check for unfinished spokes. If unfinished # don't continue if key == Prompt.CONTINUE: for spoke in self._spokes.values(): if not spoke.completed and spoke.mandatory: print( _("Please complete all spokes before continuing")) return InputState.DISCARDED elif key == Prompt.HELP: help_path = self._get_help() if help_path: ScreenHandler.push_screen_modal(HelpScreen(help_path)) return InputState.PROCESSED_AND_REDRAW return key
# it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Simpleline is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Simpleline. If not, see <https://www.gnu.org/licenses/>. # # Show help screen. # # Usage of the HelpScreen advanced widget. # There are many of advanced widgets which have different uses. # I've recommend developer to look on them. from simpleline import App from simpleline.render.screen_handler import ScreenHandler from simpleline.render.adv_widgets import HelpScreen if __name__ == "__main__": App.initialize() # You need to pass file with help text to the screen. s = HelpScreen("./04_help/example_help.txt") ScreenHandler.schedule_screen(s) App.run()