Exemplo n.º 1
0
    def text_info(self, *args, **kwds):
        """dispaly Display text information dialog

        @param save   save the content in current file
        @param backup extenion of backup filename
        @return content content user inputed
        """
        (_kwds, opts) = utils.parse_kwds(kwds, ['save', 'backup'])
        content = self.__call('text-info', *args, **_kwds)
        if opts.get('save') and _kwds.get('filename'):
            utils.savefile(_kwds.get('filename'), content, backup=opts.get('backup'))
        return content
Exemplo n.º 2
0
    def calendar(self, *args, **kwds):
        """display calendar dialog

        @param text=TEXT                                    Set the dialog text
        @param selected_day=DAY                             Set the calendar day
        @param date_format=PATTERN                          Set the format for the returned date
        @return  datetime.date
        """
        (_kwds, opts) = utils.parse_kwds(kwds, ['selected_day'])
        selected = opts.get('selected_day')
        if selected:
            _kwds['day'] = selected.day
            _kwds['month'] = selected.month
            _kwds['year'] = selected.year
        retval = self.__call('calendar', *args, **_kwds)
        if self.conf.dry_run:
            return retval
        if retval:
            (month, day, year) = map(int, retval.split('/'))
            return datetime.date(year, month, day)