Example #1
0
 def __init__(self, message=None, **kwargs):
     """
     :param message: message to bounce (defaults to selected message)
     :type message: `alot.db.message.Message`
     """
     self.message = message
     Command.__init__(self, **kwargs)
Example #2
0
 def __init__(self, thread=None, **kwargs):
     """
     :param thread: thread to open (Uses focussed thread if unset)
     :type thread: :class:`~alot.db.Thread`
     """
     self.thread = thread
     Command.__init__(self, **kwargs)
Example #3
0
 def __init__(self, command, **kwargs):
     """
     :param command: python command string to call
     :type command: str
     """
     Command.__init__(self, **kwargs)
     self.command = command
Example #4
0
 def __init__(self, key='', **kwargs):
     """
     :param key: key of the header to change
     :type key: str
     """
     Command.__init__(self, **kwargs)
     self.key = key
Example #5
0
 def __init__(self, hint=None, **kwargs):
     """
     :param hint: which attached file to remove
     :type hint: str
     """
     Command.__init__(self, **kwargs)
     self.hint = hint
Example #6
0
 def __init__(self, command, **kwargs):
     """
     :param command: python command string to call
     :type command: str
     """
     Command.__init__(self, **kwargs)
     self.command = command
Example #7
0
 def __init__(self, filtfun=None, **kwargs):
     """
     :param filtfun: filter to apply to displayed list
     :type filtfun: callable (str->bool)
     """
     self.filtfun = filtfun
     Command.__init__(self, **kwargs)
Example #8
0
 def __init__(self, attachment, **kwargs):
     """
     :param attachment: attachment to open
     :type attachment: :class:`~alot.message.Attachment`
     """
     Command.__init__(self, **kwargs)
     self.attachment = attachment
Example #9
0
 def __init__(self, buffer=None, **kwargs):
     """
     :param buffer: the buffer to close or None for current
     :type buffer: `alot.buffers.Buffer`
     """
     self.buffer = buffer
     Command.__init__(self, **kwargs)
Example #10
0
 def __init__(self, startwith='', **kwargs):
     """
     :param startwith: initial content of the prompt widget
     :type startwith: str
     """
     self.startwith = startwith
     Command.__init__(self, **kwargs)
Example #11
0
 def __init__(self, commandname='', **kwargs):
     """
     :param commandname: command to document
     :type commandname: str
     """
     Command.__init__(self, **kwargs)
     self.commandname = commandname
Example #12
0
 def __init__(self, hint=None, **kwargs):
     """
     :param hint: which attached file to remove
     :type hint: str
     """
     Command.__init__(self, **kwargs)
     self.hint = hint
Example #13
0
 def __init__(self, all=False, **kwargs):
     """
     :param all: remove all messages from thread, not just selected one
     :type all: bool
     """
     Command.__init__(self, **kwargs)
     self.all = all
Example #14
0
 def __init__(self, path=None, **kwargs):
     """
     :param path: files to attach (globable string)
     :type path: str
     """
     Command.__init__(self, **kwargs)
     self.path = path
Example #15
0
 def __init__(self, all=False, **kwargs):
     """
     :param all: remove all messages from thread, not just selected one
     :type all: bool
     """
     Command.__init__(self, **kwargs)
     self.all = all
Example #16
0
 def __init__(self, callback=None, **kwargs):
     """
     :param callback: function to call after successful writeout
     :type callback: callable
     """
     Command.__init__(self, **kwargs)
     self.callback = callback
Example #17
0
 def __init__(self, key, **kwargs):
     """
     :param key: key of the header to remove
     :type key: str
     """
     self.key = key
     Command.__init__(self, **kwargs)
Example #18
0
 def __init__(self, attachment, **kwargs):
     """
     :param attachment: attachment to open
     :type attachment: :class:`~alot.db.attachment.Attachment`
     """
     Command.__init__(self, **kwargs)
     self.attachment = attachment
Example #19
0
 def __init__(self, startwith='', **kwargs):
     """
     :param startwith: initial content of the prompt widget
     :type startwith: str
     """
     self.startwith = startwith
     Command.__init__(self, **kwargs)
Example #20
0
 def __init__(self, commandname='', **kwargs):
     """
     :param commandname: command to document
     :type commandname: str
     """
     Command.__init__(self, **kwargs)
     self.commandname = commandname
Example #21
0
 def __init__(self, filtfun=None, **kwargs):
     """
     :param filtfun: filter to apply to displayed list
     :type filtfun: callable (str->bool)
     """
     self.filtfun = filtfun
     Command.__init__(self, **kwargs)
Example #22
0
 def __init__(self, path=None, **kwargs):
     """
     :param path: files to attach (globable string)
     :type path: str
     """
     Command.__init__(self, **kwargs)
     self.path = path
Example #23
0
 def __init__(self, key, **kwargs):
     """
     :param key: key of the header to remove
     :type key: str
     """
     self.key = key
     Command.__init__(self, **kwargs)
Example #24
0
 def __init__(self, key='', **kwargs):
     """
     :param key: key of the header to change
     :type key: str
     """
     Command.__init__(self, **kwargs)
     self.key = key
Example #25
0
 def __init__(self, message=None, **kwargs):
     """
     :param message: message to reply to (defaults to selected message)
     :type message: `alot.message.Message`
     """
     self.message = message
     Command.__init__(self, **kwargs)
Example #26
0
 def __init__(self, thread=None, **kwargs):
     """
     :param thread: thread to open (Uses focussed thread if unset)
     :type thread: :class:`~alot.db.Thread`
     """
     self.thread = thread
     Command.__init__(self, **kwargs)
Example #27
0
 def __init__(self, query, **kwargs):
     """
     :param query: notmuch querystring
     :type query: str
     """
     self.query = " ".join(query)
     Command.__init__(self, **kwargs)
Example #28
0
 def __init__(self, buffer=None, **kwargs):
     """
     :param buffer: the buffer to close or None for current
     :type buffer: `alot.buffers.Buffer`
     """
     self.buffer = buffer
     Command.__init__(self, **kwargs)
Example #29
0
    def __init__(self,
                 envelope=None,
                 headers={},
                 template=None,
                 sender=u'',
                 subject=u'',
                 to=[],
                 cc=[],
                 bcc=[],
                 attach=None,
                 omit_signature=False,
                 spawn=None,
                 rest=[],
                 **kwargs):
        """
        :param envelope: use existing envelope
        :type envelope: :class:`~alot.db.envelope.Envelope`
        :param headers: forced header values
        :type headers: dict (str->str)
        :param template: name of template to parse into the envelope after
                         creation. This should be the name of a file in your
                         template_dir
        :type template: str
        :param sender: From-header value
        :type sender: str
        :param subject: Subject-header value
        :type subject: str
        :param to: To-header value
        :type to: str
        :param cc: Cc-header value
        :type cc: str
        :param bcc: Bcc-header value
        :type bcc: str
        :param attach: Path to files to be attached (globable)
        :type attach: str
        :param omit_signature: do not attach/append signature
        :type omit_signature: bool
        :param spawn: force spawning of editor in a new terminal
        :type spawn: bool
        :param rest: remaining parameters. These can start with
                     'mailto' in which case it is interpreted as mailto string.
                     Otherwise it will be interpreted as recipients (to) header
        :type rest: list(str)
        """

        Command.__init__(self, **kwargs)

        self.envelope = envelope
        self.template = template
        self.headers = headers
        self.sender = sender
        self.subject = subject
        self.to = to
        self.cc = cc
        self.bcc = bcc
        self.attach = attach
        self.omit_signature = omit_signature
        self.force_spawn = spawn
        self.rest = ' '.join(rest)
Example #30
0
 def __init__(self, envelope=None, **kwargs):
     """
     :param envelope: email to edit
     :type envelope: :class:`~alot.message.Envelope`
     """
     self.envelope = envelope
     self.openNew = (envelope != None)
     Command.__init__(self, **kwargs)
Example #31
0
 def __init__(self, query=None, **kwargs):
     """
     :param query: new querystring given as list of strings as returned by
                   argparse
     :type query: list of str
     """
     self.querystring = ' '.join(query)
     Command.__init__(self, **kwargs)
Example #32
0
 def __init__(self, callback=None, silent=False, **kwargs):
     """
     :param callback: function to call after successful writeout
     :type callback: callable
     """
     Command.__init__(self, **kwargs)
     self.callback = callback
     self.silent = silent
Example #33
0
 def __init__(self, query, sort=None, **kwargs):
     """
     :param query: notmuch querystring
     :type query: str
     """
     self.query = ' '.join(query)
     self.order = sort
     Command.__init__(self, **kwargs)
Example #34
0
 def __init__(self, query, sort=None, **kwargs):
     """
     :param query: notmuch querystring
     :type query: str
     """
     self.query = ' '.join(query)
     self.order = sort
     Command.__init__(self, **kwargs)
Example #35
0
    def __init__(self,
                 cmd,
                 stdin=None,
                 shell=False,
                 spawn=False,
                 refocus=True,
                 thread=False,
                 on_success=None,
                 **kwargs):
        """
        :param cmd: the command to call
        :type cmd: list or str
        :param stdin: input to pipe to the process
        :type stdin: file or str
        :param spawn: run command in a new terminal
        :type spawn: bool
        :param shell: let shell interpret command string
        :type shell: bool
        :param thread: run asynchronously, don't block alot
        :type thread: bool
        :param refocus: refocus calling buffer after cmd termination
        :type refocus: bool
        :param on_success: code to execute after command successfully exited
        :type on_success: callable
        """
        logging.debug({'spawn': spawn})
        # make sure cmd is a list of str
        if isinstance(cmd, unicode):
            # convert cmdstring to list: in case shell==True,
            # Popen passes only the first item in the list to $SHELL
            cmd = [cmd] if shell else split_commandstring(cmd)

        # determine complete command list to pass
        touchhook = settings.get_hook('touch_external_cmdlist')
        # filter cmd, shell and thread through hook if defined
        if touchhook is not None:
            logging.debug('calling hook: touch_external_cmdlist')
            res = touchhook(cmd, shell=shell, spawn=spawn, thread=thread)
            logging.debug('got: %s' % res)
            cmd, shell, self.in_thread = res
        # otherwise if spawn requested and X11 is running
        elif spawn:
            if 'DISPLAY' in os.environ:
                term_cmd = settings.get('terminal_cmd', '')
                logging.info('spawn in terminal: %s' % term_cmd)
                termcmdlist = split_commandstring(term_cmd)
                cmd = termcmdlist + cmd
            else:
                thread = False

        self.cmdlist = cmd
        self.stdin = stdin
        self.shell = shell
        self.refocus = refocus
        self.in_thread = thread
        self.on_success = on_success
        Command.__init__(self, **kwargs)
Example #36
0
File: thread.py Project: t-8ch/alot
 def __init__(self,
              cmd,
              all=False,
              separately=False,
              background=False,
              shell=False,
              notify_stdout=False,
              format='raw',
              add_tags=False,
              noop_msg='no command specified',
              confirm_msg='',
              done_msg='done',
              **kwargs):
     """
     :param cmd: shellcommand to open
     :type cmd: str or list of str
     :param all: pipe all, not only selected message
     :type all: bool
     :param separately: call command once per message
     :type separately: bool
     :param background: do not suspend the interface
     :type background: bool
     :param notify_stdout: display command\'s stdout as notification message
     :type notify_stdout: bool
     :param shell: let the shell interpret the command
     :type shell: bool
     :param format: what to pipe to the processes stdin. one of:
                    'raw': message content as is,
                    'decoded': message content, decoded quoted printable,
                    'id': message ids, separated by newlines,
                    'filepath': paths to message files on disk
     :type format: str
     :param add_tags: add 'Tags' header to the message
     :type add_tags: bool
     :param noop_msg: error notification to show if `cmd` is empty
     :type noop_msg: str
     :param confirm_msg: confirmation question to ask (continues directly if
                         unset)
     :type confirm_msg: str
     :param done_msg: notification message to show upon success
     :type done_msg: str
     """
     Command.__init__(self, **kwargs)
     if isinstance(cmd, unicode):
         cmd = split_commandstring(cmd)
     self.cmd = cmd
     self.whole_thread = all
     self.separately = separately
     self.background = background
     self.shell = shell
     self.notify_stdout = notify_stdout
     self.output_format = format
     self.add_tags = add_tags
     self.noop_msg = noop_msg
     self.confirm_msg = confirm_msg
     self.done_msg = done_msg
Example #37
0
File: thread.py Project: t-8ch/alot
 def __init__(self, message=None, spawn=None, **kwargs):
     """
     :param message: message to reply to (defaults to selected message)
     :type message: `alot.db.message.Message`
     :param spawn: force spawning of editor in a new terminal
     :type spawn: bool
     """
     self.message = message
     self.force_spawn = spawn
     Command.__init__(self, **kwargs)
Example #38
0
File: globals.py Project: a3nm/alot
 def __init__(self, buffer=None, force=False, **kwargs):
     """
     :param buffer: the buffer to close or None for current
     :type buffer: `alot.buffers.Buffer`
     :param force: force buffer close
     :type force: bool
     """
     self.buffer = buffer
     self.force = force
     Command.__init__(self, **kwargs)
Example #39
0
 def __init__(self, action=None, keyid=None, **kwargs):
     """
     :param action: whether to sign/unsign/toggle
     :type action: str
     :param keyid: which key id to use
     :type keyid: str
     """
     self.action = action
     self.keyid = keyid
     Command.__init__(self, **kwargs)
Example #40
0
 def __init__(self, all=False, visible=None, **kwargs):
     """
     :param all: toggle all, not only selected message
     :type all: bool
     :param visible: unfold if `True`, fold if `False`
     :type visible: bool
     """
     self.all = all
     self.visible = visible
     Command.__init__(self, **kwargs)
Example #41
0
 def __init__(self, tags=u'', thread=None, **kwargs):
     """
     :param tags: comma separated list of tagstrings to set
     :type tags: str
     :param thread: thread to edit (Uses focussed thread if unset)
     :type thread: :class:`~alot.db.Thread` or None
     """
     self.tagsstring = tags
     self.thread = thread
     Command.__init__(self, **kwargs)
Example #42
0
 def __init__(self, action=None, keyid=None, **kwargs):
     """
     :param action: whether to sign/unsign/toggle
     :type action: str
     :param keyid: which key id to use
     :type keyid: str
     """
     self.action = action
     self.keyid = keyid
     Command.__init__(self, **kwargs)
Example #43
0
 def __init__(self, message=None, attach=True, **kwargs):
     """
     :param message: message to forward (defaults to selected message)
     :type message: `alot.message.Message`
     :param attach: attach original mail instead of inline quoting its body
     :type attach: bool
     """
     self.message = message
     self.inline = not attach
     Command.__init__(self, **kwargs)
Example #44
0
 def __init__(self, message=None, spawn=None, **kwargs):
     """
     :param message: message to reply to (defaults to selected message)
     :type message: `alot.db.message.Message`
     :param spawn: force spawning of editor in a new terminal
     :type spawn: bool
     """
     self.message = message
     self.force_spawn = spawn
     Command.__init__(self, **kwargs)
Example #45
0
 def __init__(self, buffer=None, force=False, **kwargs):
     """
     :param buffer: the buffer to close or None for current
     :type buffer: `alot.buffers.Buffer`
     :param force: force buffer close
     :type force: bool
     """
     self.buffer = buffer
     self.force = force
     Command.__init__(self, **kwargs)
Example #46
0
 def __init__(self, message=None, all=False, **kwargs):
     """
     :param message: message to reply to (defaults to selected message)
     :type message: `alot.message.Message`
     :param all: group reply; copies recipients from Bcc/Cc/To to the reply
     :type all: bool
     """
     self.message = message
     self.groupreply = all
     Command.__init__(self, **kwargs)
Example #47
0
    def __init__(
        self,
        envelope=None,
        headers={},
        template=None,
        sender=u"",
        subject=u"",
        to=[],
        cc=[],
        bcc=[],
        attach=None,
        omit_signature=False,
        spawn=None,
        **kwargs
    ):
        """
        :param envelope: use existing envelope
        :type envelope: :class:`~alot.db.envelope.Envelope`
        :param headers: forced header values
        :type header: doct (str->str)
        :param template: name of template to parse into the envelope after
                         creation. This should be the name of a file in your
                         template_dir
        :type template: str
        :param sender: From-header value
        :type sender: str
        :param subject: Subject-header value
        :type subject: str
        :param to: To-header value
        :type to: str
        :param cc: Cc-header value
        :type cc: str
        :param bcc: Bcc-header value
        :type bcc: str
        :param attach: Path to files to be attached (globable)
        :type attach: str
        :param omit_signature: do not attach/append signature
        :type omit_signature: bool
        :param spawn: force spawning of editor in a new terminal
        :type spawn: bool
        """

        Command.__init__(self, **kwargs)

        self.envelope = envelope
        self.template = template
        self.headers = headers
        self.sender = sender
        self.subject = subject
        self.to = to
        self.cc = cc
        self.bcc = bcc
        self.attach = attach
        self.omit_signature = omit_signature
        self.force_spawn = spawn
Example #48
0
 def __init__(self, key, value, append=False, **kwargs):
     """
     :param key: key of the header to change
     :type key: str
     :param value: new value
     :type value: str
     """
     self.key = key
     self.value = ' '.join(value)
     self.reset = not append
     Command.__init__(self, **kwargs)
Example #49
0
    def __init__(self, action=None, keyids=None, **kwargs):
        """
        :param action: wether to encrypt/unencrypt/toggleencrypt
        :type action: str
        :param keyid: the id of the key to encrypt
        :type keyid: str
        """

        self.encrypt_keys = keyids
        self.action = action
        Command.__init__(self, **kwargs)
Example #50
0
 def __init__(self, tag, thread=None, **kwargs):
     """
     :param tag: list of tagstrings to flip
     :type tag: list of str
     :param thread: thread to edit (Uses focussed thread if unset)
     :type thread: :class:`~alot.db.Thread` or None
     """
     assert tag
     self.thread = thread
     self.tags = set(tag)
     Command.__init__(self, **kwargs)
Example #51
0
 def __init__(self, all=False, path=None, **kwargs):
     """
     :param all: save all, not only selected attachment
     :type all: bool
     :param path: path to write to. if `all` is set, this must be a
                  directory.
     :type path: str
     """
     Command.__init__(self, **kwargs)
     self.all = all
     self.path = path
Example #52
0
File: thread.py Project: t-8ch/alot
 def __init__(self, all=False, path=None, **kwargs):
     """
     :param all: save all, not only selected attachment
     :type all: bool
     :param path: path to write to. if `all` is set, this must be a
                  directory.
     :type path: str
     """
     Command.__init__(self, **kwargs)
     self.all = all
     self.path = path
Example #53
0
 def __init__(self, key, value, append=False, **kwargs):
     """
     :param key: key of the header to change
     :type key: str
     :param value: new value
     :type value: str
     """
     self.key = key
     self.value = ' '.join(value)
     self.reset = not append
     Command.__init__(self, **kwargs)
Example #54
0
    def __init__(self, action=None, keyids=None, **kwargs):
        """
        :param action: wether to encrypt/unencrypt/toggleencrypt
        :type action: str
        :param keyid: the id of the key to encrypt
        :type keyid: str
        """

        self.encrypt_keys = keyids
        self.action = action
        Command.__init__(self, **kwargs)
Example #55
0
    def __init__(self,
                 envelope=None,
                 headers={},
                 template=None,
                 sender=u'',
                 subject=u'',
                 to=[],
                 cc=[],
                 bcc=[],
                 attach=None,
                 omit_signature=False,
                 spawn=None,
                 **kwargs):
        """
        :param envelope: use existing envelope
        :type envelope: :class:`~alot.db.envelope.Envelope`
        :param headers: forced header values
        :type header: doct (str->str)
        :param template: name of template to parse into the envelope after
                         creation. This should be the name of a file in your
                         template_dir
        :type template: str
        :param sender: From-header value
        :type sender: str
        :param subject: Subject-header value
        :type subject: str
        :param to: To-header value
        :type to: str
        :param cc: Cc-header value
        :type cc: str
        :param bcc: Bcc-header value
        :type bcc: str
        :param attach: Path to files to be attached (globable)
        :type attach: str
        :param omit_signature: do not attach/append signature
        :type omit_signature: bool
        :param spawn: force spawning of editor in a new terminal
        :type spawn: bool
        """

        Command.__init__(self, **kwargs)

        self.envelope = envelope
        self.template = template
        self.headers = headers
        self.sender = sender
        self.subject = subject
        self.to = to
        self.cc = cc
        self.bcc = bcc
        self.attach = attach
        self.omit_signature = omit_signature
        self.force_spawn = spawn
Example #56
0
 def __init__(self, query, sort=None, **kwargs):
     """
     :param query: notmuch querystring
     :type query: str
     :param sort: how to order results. Must be one of
                  'oldest_first', 'newest_first', 'message_id' or
                  'unsorted'.
     :type sort: str
     """
     self.query = ' '.join(query)
     self.order = sort
     Command.__init__(self, **kwargs)
Example #57
0
 def __init__(self, buffer=None, offset=0, **kwargs):
     """
     :param buffer: the buffer to focus or None
     :type buffer: `alot.buffers.Buffer`
     :param offset: position of the buffer to focus relative to the
                    currently focussed one. This is used only if `buffer`
                    is set to `None`
     :type offset: int
     """
     self.buffer = buffer
     self.offset = offset
     Command.__init__(self, **kwargs)
Example #58
0
 def __init__(self, mail=None, envelope=None, **kwargs):
     """
     :param mail: email to send
     :type email: email.message.Message
     :param envelope: envelope to use to construct the outgoing mail. This
                      will be ignored in case the mail parameter is set.
     :type envelope: alot.db.envelope.envelope
     """
     Command.__init__(self, **kwargs)
     self.mail = mail
     self.envelope = envelope
     self.envelope_buffer = None
Example #59
0
 def __init__(self, query=None, sort=None, **kwargs):
     """
     :param query: new querystring given as list of strings as returned by
                   argparse
     :type query: list of str
     """
     if query is None:
         self.querystring = None
     else:
         self.querystring = ' '.join(query)
     self.sort_order = sort
     Command.__init__(self, **kwargs)
Example #60
0
File: thread.py Project: t-8ch/alot
 def __init__(self, message=None, all=False, spawn=None, **kwargs):
     """
     :param message: message to reply to (defaults to selected message)
     :type message: `alot.db.message.Message`
     :param all: group reply; copies recipients from Bcc/Cc/To to the reply
     :type all: bool
     :param spawn: force spawning of editor in a new terminal
     :type spawn: bool
     """
     self.message = message
     self.groupreply = all
     self.force_spawn = spawn
     Command.__init__(self, **kwargs)