File: uuuidgen.py

package info (click to toggle)
far2l 2.7.0~beta%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,304 kB
  • sloc: cpp: 263,566; ansic: 53,886; python: 7,048; sh: 1,516; perl: 410; javascript: 279; xml: 145; makefile: 31
file content (29 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import logging
import uuid
from far2l.plugin import PluginBase


log = logging.getLogger(__name__)


class Plugin(PluginBase):
    label = "Python uuuidgen"
    openFrom = ["PLUGINSMENU", "EDITOR"]

    @staticmethod
    def HandleCommandLine(line):
        return line in ("uuidgen",)

    def CommandLine(self, line):
        if line != "uuidgen":
            return
        self.uuidgen()

    def uuidgen(self):
        s = '{%s}'%uuid.uuid4()
        log.debug('uuidgen: {}'.format(s))
        self.info.FSF.CopyToClipboard(self.s2f(s))

    def OpenPlugin(self, OpenFrom):
        self.uuidgen()
        return -1