def prompt(self): # get the description if not self.description: self._description = Output.prompt( "\n Please describe the work done in this version:\n ", blank=False, separator=">>>" )
def prompt(self): print "" product_display = " [{b}{p}{r}]".format( b=Style.bright, p=self._product, r=Style.reset, ) # category menu if not self._category: self._category = Output.prompt_menu( "Product categories", "{pd} category".format(pd=product_display), zip(*[Product.category_names()] * 2), ) # description if not self._description: self._description = Output.prompt( '{pd} description'.format(pd=product_display), blank=False, ) # file type if not self._file_type: if not self._file_type: self._file_type = Output.prompt( "{pd} file type".format(pd=product_display), blank=False, ) # resolution if not self._resolution: self._resolution = Output.prompt( "{pd} resolution (Return if none)".format(pd=product_display), blank=True, ) if not self._resolution: self._resolution = 'none'
def prompt(self): # ---- prompt for missing fields if not self.code or not self.server: print "\nPlease enter the following information:" if not self.code: print "\nThe db code for this location:" self._code = Output.prompt( " " + Style.bright + "Location code" + Style.reset, blank=False, ) if not self.server: print "\nThe address of the data server this location will " + \ "connect to:" self._server = Output.prompt( " " + Style.bright + "Data server address" + Style.reset, blank=False, )
def prompt(self): if self._subject is None: self._subject = Output.prompt( Style.bright + \ "\nEnter a one line description of the problem" + \ Style.normal, blank=False, help_str="Subject line can't be blank.", separator = ":\n" ) if self._message is None: self._message = Output.prompt_text_block( Style.bright + \ "\nEnter a detailed description of the problem.\n" + \ Style.normal + \ " Include steps to replicate, errors, etc below.\n" + \ " You can copy/paste below as well.\n", blank=False, help_str="Message can't be blank.", )
def prompt(self): parent_spec = PTaskSpec.parent(self.spec) template_options = [] if parent_spec: par_ptask = PTask.get(parent_spec) par_ptask_type = par_ptask.ptask_type else: par_ptask_type = 'none' ptask_area = PTaskArea(parent_spec, validate=False) master_config = ptask_area.config( PROJECT_MASTER_CONFIG_PATH, composite_ancestors=True, ) if not master_config or not hasattr(master_config, 'hierarchy'): raise ActionError("Unable to find project master config.") if not self.ptask_type in master_config.hierarchy[par_ptask_type]: raise ActionError( "Cannot create '{t}' ptask inside '{p}' ptask".format( t=self.ptask_type, p=par_ptask_type, )) # ---- prompt for missing fields if not self.source and self.ptask_type in master_config.templates: for template_spec in master_config.templates[self.ptask_type]: trimmed_spec = re.sub("^templates?=", "", template_spec, flags=re.IGNORECASE) template_options.append( (re.sub("[=_-]+", " ", trimmed_spec).title(), template_spec)) self._source = Output.prompt_menu( "Select a template to source", prompt_str="Selection", options=template_options, help_str="Please choose from the templates listed.", none_option=True, custom_prompt="Custom Source", custom_blank=False) # see if the ptask already exists if not self.ptask: try: self._ptask = PTask.get(self.spec) except PTaskError: pass else: if not self.force: raise ActionAborted("PTask already exists.") else: if not self._description: self._description = self.ptask.description if not self._start_date: self._start_date = self.ptask.start_date if not self._due_date: self._due_date = self.ptask.due_date if (not self.description or not self.start_date or not self.due_date): if self.force: raise ActionError( "Cannot force creation without required fields.") else: print "\nPlease enter information about this new {b}{t}{r}:".\ format( b=Style.bright, t=self.ptask_type, r=Style.reset, ) ptask_display = " [{pt}] {b}{s}{r}".format( pt=self.ptask_type, b=Style.bright, s=self.spec, r=Style.reset, ) if not self.description: self._description = Output.prompt( '{pd} description'.format(pd=ptask_display), blank=False, ) if not self.start_date: self._start_date = Output.prompt_date( '{pd} start date'.format(pd=ptask_display), blank=False, ) if not self.due_date: self._due_date = Output.prompt_date( '{pd} due date'.format(pd=ptask_display), blank=False, )
def prompt(self): parent_spec = PTaskSpec.parent(self.spec) template_options = [] if parent_spec: par_ptask = PTask.get(parent_spec) par_ptask_type = par_ptask.ptask_type else: par_ptask_type = 'none' ptask_area = PTaskArea(parent_spec, validate=False) master_config = ptask_area.config( PROJECT_MASTER_CONFIG_PATH, composite_ancestors=True, ) if not master_config or not hasattr(master_config, 'hierarchy'): raise ActionError("Unable to find project master config.") if not self.ptask_type in master_config.hierarchy[par_ptask_type]: raise ActionError( "Cannot create '{t}' ptask inside '{p}' ptask".format( t=self.ptask_type, p=par_ptask_type, ) ) # ---- prompt for missing fields if not self.source and self.ptask_type in master_config.templates: for template_spec in master_config.templates[self.ptask_type]: trimmed_spec = re.sub( "^templates?=", "", template_spec, flags=re.IGNORECASE ) template_options.append( ( re.sub("[=_-]+", " ", trimmed_spec).title(), template_spec ) ) self._source = Output.prompt_menu( "Select a template to source", prompt_str="Selection", options=template_options, help_str="Please choose from the templates listed.", none_option=True, custom_prompt="Custom Source", custom_blank=False ) # see if the ptask already exists if not self.ptask: try: self._ptask = PTask.get(self.spec) except PTaskError: pass else: if not self.force: raise ActionAborted("PTask already exists.") else: if not self._description: self._description = self.ptask.description if not self._start_date: self._start_date = self.ptask.start_date if not self._due_date: self._due_date = self.ptask.due_date if (not self.description or not self.start_date or not self.due_date): if self.force: raise ActionError( "Cannot force creation without required fields." ) else: print "\nPlease enter information about this new {b}{t}{r}:".\ format( b=Style.bright, t=self.ptask_type, r=Style.reset, ) ptask_display = " [{pt}] {b}{s}{r}".format( pt=self.ptask_type, b=Style.bright, s=self.spec, r=Style.reset, ) if not self.description: self._description = Output.prompt( '{pd} description'.format(pd=ptask_display), blank=False, ) if not self.start_date: self._start_date = Output.prompt_date( '{pd} start date'.format(pd=ptask_display), blank=False, ) if not self.due_date: self._due_date = Output.prompt_date( '{pd} due date'.format(pd=ptask_display), blank=False, )