Example #1
0
 def error(self, msg):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.error(msg)
     if ctx.get_option('no_color'):
         self.output(_('Error: ') + msg + '\n', err=True)
     else:
         self.output(colorize(msg + '\n', 'red'), err=True)
Example #2
0
 def warning(self, msg, verbose = False):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.warning(msg)
     if ctx.get_option('no_color'):
         self.output(_('Warning: ') + msg + '\n', err=True, verbose=verbose)
     else:
         self.output(colorize(msg + '\n', 'purple'), err=True, verbose=verbose)
Example #3
0
 def error(self, msg):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.error(msg)
     if ctx.get_option('no_color'):
         self.output(_('Error: ') + msg + '\n', err=True)
     else:
         self.output(colorize(msg + '\n', 'red'), err=True)
Example #4
0
 def warning(self, msg, verbose=False):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.warning(msg)
     if ctx.get_option("no_color"):
         self.output(_("Warning: ") + msg + "\n", err=True, verbose=verbose)
     else:
         self.output(colorize(msg + "\n", "purple"), err=True, verbose=verbose)
Example #5
0
 def error(self, msg):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.error(msg)
     if ctx.get_option("no_color"):
         self.output(_("Error: ") + msg + "\n", err=True)
     else:
         self.output(colorize(msg + "\n", "red"), err=True)
Example #6
0
 def display_progress(self, **ka):
     totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size'])
     out = '\r%-30.30s (%s)%3d%% %9.2f %s [%s]' % \
         (ka['filename'], totalsize, ka['percent'],
          ka['rate'], ka['symbol'], ka['eta'])
     self.output(out)
     if ka['percent'] == 100:
         self.output(colorize(_(' [complete]\n'), 'gray'))
Example #7
0
 def display_progress(self, **ka):
     totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size']) 
     out = '\r%-30.30s (%s)%3d%% %9.2f %s [%s]' % \
         (ka['filename'], totalsize, ka['percent'], 
          ka['rate'], ka['symbol'], ka['eta'])
     self.output(out)
     if ka['percent'] == 100:
         self.output(colorize(_(' [complete]\n'), 'gray'))
Example #8
0
 def confirm(self, msg):
     if ctx.config.options and ctx.config.options.yes_all:
         return True
     while True:
         s = raw_input(msg + colorize('(yes/no)', 'red'))
         if s.startswith('y') or s.startswith('Y'):
             return True
         if s.startswith('n') or s.startswith('N'):
             return False
Example #9
0
 def confirm(self, msg):
     if ctx.config.options and ctx.config.options.yes_all:
         return True
     while True:
         s = raw_input(msg + colorize("(yes/no)", "red"))
         if s.startswith("y") or s.startswith("Y"):
             return True
         if s.startswith("n") or s.startswith("N"):
             return False
Example #10
0
 def warning(self, msg, verbose=False):
     msg = unicode(msg)
     if ctx.log:
         ctx.log.warning(msg)
     if ctx.get_option('no_color'):
         self.output(_('Warning: ') + msg + '\n', err=True, verbose=verbose)
     else:
         self.output(colorize(msg + '\n', 'purple'),
                     err=True,
                     verbose=verbose)
Example #11
0
 def notify(self, event, **keywords):
     if event == ui.installed:
         msg = _('Installed %s') % keywords['package'].name
     elif event == ui.removed:
         msg = _('Removed %s') % keywords['package'].name
     elif event == ui.upgraded:
         msg = _('Upgraded %s') % keywords['package'].name
     else:
         msg = None
     if msg:
         self.output(colorize(msg + '\n', 'cyan'))
Example #12
0
 def choose(self, msg, opts):
     print msg
     for i in range(0, len(opts)):
         print i + 1, opts(i)
     while True:
         s = raw_input(msg + colorize('1-%d' % len(opts), 'red'))
         try:
             opt = int(s)
             if 1 <= opt and opt <= len(opts):
                 return opts(opt - 1)
         except (Exception, e):
             pass
Example #13
0
 def choose(self, msg, opts):
     print msg
     for i in range(0,len(opts)):
         print i + 1, opts(i)
     while True:
         s = raw_input(msg + colorize('1-%d' % len(opts), 'red'))
         try:
             opt = int(s)
             if 1 <= opt and opt <= len(opts):
                 return opts(opt-1)
         except (Exception,e):
             pass
Example #14
0
    def confirm(self, msg):
        if ctx.config.options and ctx.config.options.yes_all:
            return True
        while True:
            import re
            yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))

            prompt = msg + colorize(_('(yes/no)'), 'red')
            s = raw_input(prompt.encode('utf-8'))
            if yesexpr.search(s):
                return True

            return False
Example #15
0
    def confirm(self, msg):
        msg = unicode(msg)
        if ctx.config.options and ctx.config.options.yes_all:
            return True
        while True:
            import re
            yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))

            prompt = msg + colorize(_(' (yes/no)'), 'red')
            s = raw_input(prompt.encode('utf-8'))
            if yesexpr.search(s):
                return True

            return False
Example #16
0
    def confirm(self, msg):
        msg = unicode(msg)
        if ctx.config.options and ctx.config.options.yes_all:
            return True
        while True:
            import re

            yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))

            prompt = msg + colorize(_(" (yes/no)"), "red")
            s = raw_input(prompt.encode("utf-8"))
            if yesexpr.search(s):
                return True

            return False
Example #17
0
 def notify(self, event, **keywords):
     if event == ui.installed:
         msg = _("Installed %s") % keywords["package"].name
     elif event == ui.removed:
         msg = _("Removed %s") % keywords["package"].name
     elif event == ui.upgraded:
         msg = _("Upgraded %s") % keywords["package"].name
     elif event == ui.configured:
         msg = _("Configured %s") % keywords["package"].name
     elif event == ui.extracting:
         msg = _("Extracting the files of %s") % keywords["package"].name
     else:
         msg = None
     if msg:
         self.output(colorize(msg + "\n", "cyan"))
Example #18
0
 def notify(self, event, **keywords):
     if event == ui.installed:
         msg = _('Installed %s') % keywords['package'].name
     elif event == ui.removed:
         msg = _('Removed %s') % keywords['package'].name
     elif event == ui.upgraded:
         msg = _('Upgraded %s') % keywords['package'].name
     elif event == ui.configured:
         msg = _('Configured %s') % keywords['package'].name
     elif event == ui.extracting:
         msg = _('Extracting the files of %s') % keywords['package'].name
     else:
         msg = None
     if msg:
         self.output(colorize(msg + '\n', 'cyan'))
Example #19
0
    def display_progress(self, operation, percent, info="", **ka):
        """ display progress of any operation """
        if operation in ["removing", "rebuilding-db"]:
            return
        elif operation == "fetching":
            totalsize = '%.1f %s' % pisi.util.human_readable_size(ka['total_size'])
            out = '\r%-30.30s (%s)%3d%% %9.2f %s [%s]' % \
                (ka['filename'], totalsize, percent,
                 ka['rate'], ka['symbol'], ka['eta'])
            self.output(out)
        else:
            self.output("\r%s (%d%%)" % (info, percent))

        if percent == 100:
            self.output(colorize(_(' [complete]\n'), 'gray'))
Example #20
0
 def notify(self, event, **keywords):
     if event == ui.installed:
         msg = _('Installed %s') % keywords['package'].name
     elif event == ui.removed:
         msg = _('Removed %s') % keywords['package'].name
     elif event == ui.upgraded:
         msg = _('Upgraded %s') % keywords['package'].name
     elif event == ui.configured:
         msg = _('Configured %s') % keywords['package'].name
     elif event == ui.extracting:
         msg = _('Extracting the files of %s') % keywords['package'].name
     else:
         msg = None
     if msg:
         self.output(colorize(msg + '\n', 'cyan'))
         if ctx.log:
             ctx.log.info(msg)
Example #21
0
    def display_progress(self, operation, percent, info="", **ka):
        """ display progress of any operation """
        if operation == "removing":
            return
        elif operation == "fetching":
            totalsize = "%.1f %s" % pisi.util.human_readable_size(ka["total_size"])
            out = "\r%-30.30s (%s)%3d%% %9.2f %s [%s]" % (
                ka["filename"],
                totalsize,
                percent,
                ka["rate"],
                ka["symbol"],
                ka["eta"],
            )
            self.output(out)
        else:
            self.output("\r%s (%d%%)" % (info, percent))

        if percent == 100:
            self.output(colorize(_(" [complete]\n"), "gray"))
Example #22
0
 def status(self, msg=None):
     if msg:
         msg = unicode(msg)
         self.output(colorize(msg + "\n", "purple"))
         util.xterm_title(msg)
Example #23
0
 def error(self,msg):
     self.output(colorize(_('Error: ') + msg + '\n', 'red'), err=True)
Example #24
0
 def action(self, msg, verbose=False):
     # TODO: this seems quite redundant?
     msg = unicode(msg)
     if ctx.log:
         ctx.log.info(msg)
     self.output(colorize(msg + "\n", "green"))
Example #25
0
 def warning(self,msg):
     self.output(colorize('Warning:' + msg + '\n', 'purple'))
Example #26
0
 def error(self,msg):
     self.output(colorize('Error:' + msg + '\n', 'red'))
Example #27
0
 def status(self, msg = None):
     if msg:
         msg = unicode(msg)
         self.output(colorize(msg + '\n', 'purple'))
         util.xterm_title(msg)
Example #28
0
 def status(self, msg = None):
     if msg:
         self.output(colorize(msg + '\n', 'purple'))
Example #29
0
 def warning(self,msg):
     if ctx.get_option('no_color'):
         self.output(_('Warning: ') + msg + '\n', err=True)
     else:
         self.output(colorize(msg + '\n', 'purple'), err=True)
Example #30
0
 def display_progress(self, **ka):
     out = '\r%-30.30s %3d%% %12.2f %s [%s]' % \
         (ka['filename'], ka['percent'], ka['rate'], ka['symbol'], ka['eta'])
     self.output(out)
     if ka['percent'] == 100:
         self.output(colorize(_(' [complete]\n'), 'gray'))
Example #31
0
 def status(self, msg=None):
     if msg:
         msg = unicode(msg)
         self.output(colorize(msg + '\n', 'purple'))
         util.xterm_title(msg)
Example #32
0
 def warning(self, msg):
     self.output(colorize("Warning:" + msg + "\n", "purple"))
Example #33
0
 def warning(self,msg):
     self.output(colorize(_('Warning: ') + msg + '\n', 'purple'), err=True)
Example #34
0
 def error(self, msg):
     self.output(colorize("Error:" + msg + "\n", "red"))
Example #35
0
 def action(self,msg):
     #TODO: this seems quite redundant?
     self.output(colorize(msg + '\n', 'green'))
Example #36
0
 def action(self, msg):
     # TODO: this seems quite redundant?
     self.output(colorize(msg + "\n", "green"))
Example #37
0
 def action(self, msg, verbose=False):
     #TODO: this seems quite redundant?
     msg = unicode(msg)
     if ctx.log:
         ctx.log.info(msg)
     self.output(colorize(msg + '\n', 'green'))
Example #38
0
 def display_progress(self, **ka):
     out = "\r%-30.30s %3d%% %12.2f %s [%s]" % (ka["filename"], ka["percent"], ka["rate"], ka["symbol"], ka["eta"])
     self.output(out)
     if ka["percent"] == 100:
         self.output(colorize(_(" [complete]\n"), "gray"))