verigak / progress

Easy to use progress bars for Python
ISC License
1.41k stars 179 forks source link

Adding elapsed time and human readable forms of eta and elapsed time #7

Closed prologic closed 10 years ago

prologic commented 11 years ago

This add three new attributes that can be used:

elapsed       elapsed time (in seconds)
human_eta     human readable eta in days, hours, mins and seconds
human_elapsed human readable elapsed time in days, hours, mins and seconds
prologic commented 11 years ago

ping?

verigak commented 11 years ago

Hey, sorry. I see the usefulness of adding elapsed but I'm not sure about the human_ variants. You could achieve the same thing with something like:


class HumanBar(Bar):
    def duration(self, seconds):
        # ...

    def format_duration(self, duration):
        # ...

    def update_stats(self):
        super(HumanBar, self).update_stats()
        self.ctx['human_eta'] = self.format_duration(self.duration(self.eta))
        self.ctx['human_elapsed'] = self.format_duration(self.duration(self.elapsed))

Granted this is not the most user friendly way, but I'd rather improve this mechanism than add too many keywords.

prologic commented 11 years ago

Hey! I guess adding another subclass is okay too. Don't know :) I wanted the new keywords so they'd work with any progress bar.

cheers James

James Mills / prologic

E: prologic@shortcircuit.net.au W: prologic.shortcircuit.net.au

On Thu, Aug 29, 2013 at 1:26 PM, Giorgos Verigakis <notifications@github.com

wrote:

Hey, sorry. I see the usefulness of adding elapsed but I'm not sure about the human_ variants. You could achieve the same thing with something like:

class HumanBar(Bar): def duration(self, seconds):

...

def format_duration(self, duration):
    # ...

def update_stats(self):
    super(HumanBar, self).update_stats()
    self.ctx['human_eta'] = self.format_duration(self.duration(self.eta))
    self.ctx['human_elapsed'] = self.format_duration(self.duration(self.elapsed))

Granted this is not the most user friendly way, but I'd rather improve this mechanism than add too many keywords.

— Reply to this email directly or view it on GitHubhttps://github.com/verigak/progress/pull/7#issuecomment-23464721 .

verigak commented 11 years ago

Let me think about it a bit more. In the meantime if you want to submit a new pull request with just the elapsed addition, I will merge it.

prologic commented 11 years ago

Okay :)

James Mills / prologic

E: prologic@shortcircuit.net.au W: prologic.shortcircuit.net.au

On Thu, Aug 29, 2013 at 1:51 PM, Giorgos Verigakis <notifications@github.com

wrote:

Let me think about it a bit more. In the meantime if you want to submit a new pull request with just the elapsed addition, I will merge it.

— Reply to this email directly or view it on GitHubhttps://github.com/verigak/progress/pull/7#issuecomment-23465331 .

victorhooi commented 10 years ago

Hi,

I was just about to raise an issue about how to do arithmetic within suffix, when I saw this ticket.

I also wanted ETA in minutes:seconds, rather than just seconds - and the self.ctx dictionary was getting passed through to self.suffix using % (https://github.com/verigak/progress/blob/master/progress/bar.py#L38), hence I couldn't see any way to do arithmetic on it.

Did we end up deciding which way we were going with this?

I'd +1 any attempt to add a human friendly version of ETA, whether as a new keyword, or some other way.

Cheers, Victor

prologic commented 10 years ago

@Victor you're welcome to use my branch in the meantime which has support for this. I'm not sure where the progress project is going with this (I haven't really looked into what upstream is doing lately).

verigak commented 10 years ago

I have added elapsed_td and eta_td to provide more friendly output (use %(elapsed_td)s and %(eta_td)s in format strings). But more importantly you can now subclass and add your own properties. Please have a look on the latest version.

prologic commented 10 years ago

Awesome work!!!! Now i can stop using my custom fork :) Thanks!

Sent from my iPad

On 28 Nov 2013, at 15:53, Giorgos Verigakis notifications@github.com wrote:

I have added elapsed_td and eta_td to provide more friendly output (use %(elapsed_td)s and %(eta_td)s in format strings). But more importantly you can now subclass and add your own properties. Please have a look on the latest version.

— Reply to this email directly or view it on GitHubhttps://github.com/verigak/progress/pull/7#issuecomment-29441866 .

victorhooi commented 10 years ago

@verigak Cool - is there any chance we can get a new release on PyPi - looking forward to using this =).

prologic commented 10 years ago

Yes new release please :) Much appreicated!

James Mills / prologic

E: prologic@shortcircuit.net.au W: prologic.shortcircuit.net.au

On Thu, Nov 28, 2013 at 4:32 PM, victorhooi notifications@github.comwrote:

@verigak https://github.com/verigak Cool - is there any chance we can get a new release on PyPi - looking forward to using this =).

— Reply to this email directly or view it on GitHubhttps://github.com/verigak/progress/pull/7#issuecomment-29442935 .

verigak commented 10 years ago

Done

prologic commented 10 years ago

Thank you!

James Mills / prologic

E: prologic@shortcircuit.net.au W: prologic.shortcircuit.net.au

On Thu, Nov 28, 2013 at 4:53 PM, Giorgos Verigakis <notifications@github.com

wrote:

Done

— Reply to this email directly or view it on GitHubhttps://github.com/verigak/progress/pull/7#issuecomment-29443542 .