Example #1
0
    def insert_timestamp(cls, active=True):
        u"""
		Insert a timestamp at the cursor position.

		TODO: show fancy calendar to pick the date from.
		TODO: add all modifier of orgmode.
		"""
        today = date.today()
        msg = u''.join([
            u'Inserting ',
            today.strftime(u'%Y-%m-%d %a'.encode(u'utf-8')), u' | Modify date'
        ])
        modifier = get_user_input(msg)

        # abort if the user canceled the input promt
        if modifier is None:
            return

        newdate = cls._modify_time(today, modifier)

        # format
        if isinstance(newdate, datetime):
            newdate = newdate.strftime(
                u'%Y-%m-%d %a %H:%M'.encode(u'utf-8')).decode(u'utf-8')
        else:
            newdate = newdate.strftime(
                u'%Y-%m-%d %a'.encode(u'utf-8')).decode(u'utf-8')
        timestamp = u'<%s>' % newdate if active else u'[%s]' % newdate

        insert_at_cursor(timestamp)
Example #2
0
    def insert_timestamp(cls, active=True):
        u"""
		Insert a timestamp (today) at the cursor position.

		TODO: show fancy calendar to pick the date from.
		"""
        today = date.today()
        msg = u''.join([
            u'Insert Date: ',
            today.strftime(u'%Y-%m-%d %a'.encode(u'utf-8')), u' | Change date'
        ])
        modifier = get_user_input(msg)

        newdate = cls._modify_time(today, modifier)

        # format
        if isinstance(newdate, datetime):
            newdate = newdate.strftime(
                u'%Y-%m-%d %a %H:%M'.encode(u'utf-8')).decode(u'utf-8')
        else:
            newdate = newdate.strftime(
                u'%Y-%m-%d %a'.encode(u'utf-8')).decode(u'utf-8')
        timestamp = u'<%s>' % newdate if active else u'[%s]' % newdate

        insert_at_cursor(timestamp)
Example #3
0
    def insert_timestamp(cls, active=True):
        u"""
		Insert a timestamp at the cursor position.

		TODO: show fancy calendar to pick the date from.
		TODO: add all modifier of orgmode.
		"""
        today = date.today()
        msg = u"".join([u"Inserting ", today.strftime(u"%Y-%m-%d %a".encode(u"utf-8")), u" | Modify date"])
        modifier = get_user_input(msg)

        # abort if the user canceled the input promt
        if modifier is None:
            return

        newdate = cls._modify_time(today, modifier)

        # format
        if isinstance(newdate, datetime):
            newdate = newdate.strftime(u"%Y-%m-%d %a %H:%M".encode(u"utf-8")).decode(u"utf-8")
        else:
            newdate = newdate.strftime(u"%Y-%m-%d %a".encode(u"utf-8")).decode(u"utf-8")
        timestamp = u"<%s>" % newdate if active else u"[%s]" % newdate

        insert_at_cursor(timestamp)
Example #4
0
	def insert_timestamp(cls, active=True):
		u"""
		Insert a timestamp (today) at the cursor position.

		TODO: show fancy calendar to pick the date from.
		"""
		today = date.today()
		msg = u''.join([u'Insert Date: ', today.strftime(u'%Y-%m-%d %a'.encode(u'utf-8')),
				u' | Change date'])
		modifier = get_user_input(msg)

		newdate = cls._modify_time(today, modifier)

		# format
		if isinstance(newdate, datetime):
			newdate = newdate.strftime(u'%Y-%m-%d %a %H:%M'.encode(u'utf-8')).decode(u'utf-8')
		else:
			newdate = newdate.strftime(u'%Y-%m-%d %a'.encode(u'utf-8')).decode(u'utf-8')
		timestamp = u'<%s>' % newdate if active else u'[%s]' % newdate

		insert_at_cursor(timestamp)