Example #1
0
	def render_interactive(self):
		helper_controller = HelperController(self.args)
		filtered = self._restartable_applications(self.applications, self.args).sorted("name")

		while True:
			view = InteractiveView()
			view.assign("applications", filtered)
			view.assign("args", self.args)
			view.assign("total_count", len(self.applications))
			view.assign("session_count", self.applications.count_type(Applications.TYPES['SESSION']))
			view.assign("static_count", self.applications.count_type(Applications.TYPES['STATIC']))
			view.render()

			# If there are only hidden applications (any listed)
			if view.get("total_count") == view.get("session_count") + view.get("static_count"):
				break

			print("\n" + _("Press application number for help or 'q' to quit"))
			answer = input("--> ")
			try:
				if answer == "q": return
				elif int(answer) <= 0 or int(answer) > len(filtered): raise IndexError
				helper_controller.print_helper(filtered[int(answer) - 1], self.args)

			except (SyntaxError, IndexError, ValueError):
				print(_("Wrong application number"))

			sys.stdout.write("\n-- " + _("Press <enter> to get list of applications") + " --")
			input()
Example #2
0
	def render_helpers(self):
		helper_controller = HelperController(self.args)
		for application in self._restartable_applications(self.applications, self.args):
			helper_controller.print_helper(application.name, self.args)
			print("")

		view = NoteForHiddenView()
		view.assign("args", self.args)
		view.assign("total_count", len(self.applications))
		view.assign("session_count", self.applications.count_type(Applications.TYPES['SESSION']))
		view.assign("static_count", self.applications.count_type(Applications.TYPES['STATIC']))
		view.render()
Example #3
0
	def dispatch(self):
		if self.args.helper:
			from tracer.controllers.helper import HelperController
			controller = HelperController(self.args, self.packages)
			controller.render()

		elif self.args.version:
			print(__version__)

		elif self.args.resource:
			from tracer.controllers.resource import ResourceController
			controller = ResourceController(self.args)
			controller.render()

		else:
			from tracer.controllers.default import DefaultController
			controller = DefaultController(self.args, self.packages)
			if self.args.helpers:
				controller.render_helpers()
			elif self.args.interactive:
				controller.render_interactive()
			else:
				controller.render()
Example #4
0
    def dispatch(self):
        if self.args.helper:
            from tracer.controllers.helper import HelperController

            controller = HelperController(self.args, self.packages)
            controller.render()

        elif self.args.version:
            print(__version__)

        elif self.args.resource:
            from tracer.controllers.resource import ResourceController

            controller = ResourceController(self.args)
            controller.render()

        else:
            from tracer.controllers.default import DefaultController

            controller = DefaultController(self.args, self.packages)
            if self.args.helpers:
                controller.render_helpers()
            elif self.args.interactive:
                controller.render_interactive()
            else:
                controller.render()