1. Python / Говнокод #11964

    −106

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    def set_usage(self, db_thread, unhandled_exc_handler):
            if self.quota and unhandled_exc_handler != self.quota:
                d = dict(total_space=format_number(float(unhandled_exc_handler) / 1073741824L, frac_precision=1))
                if unhandled_exc_handler > self.quota:
                    arch.tray_icon.bubble(trans(u'Good news: you now have %(total_space)sGB of storage space on Dropbox.') % d, trans(u'Space increased'))
                else:
                    arch.tray_icon.bubble(trans(u'You now have %(total_space)sGB of storage space on Dropbox.') % d, trans(u'Space reduced'))
            self.in_use, self.quota = db_thread, unhandled_exc_handler
            specified_profiler = arch.tray_icon.can_click_bubbles()
            warning, caption = (None, None)
            last_warning = self.config.get('last_quota_warning')
            if db_thread > unhandled_exc_handler:
                warning = trans(u'Your Dropbox is full and cannot store more files. Upgrade and instantly get more space.')
                caption = trans(u'Dropbox full')
            elif db_thread * 100 / unhandled_exc_handler >= self.ui_flags.get('low_space_pct_threshold', 90):
                warning = trans(u'Your Dropbox is almost full. Upgrade and instantly get more space.')
                caption = trans(u'Dropbox almost full')
            elif last_warning:
                TRACE('Quota looks okay; clearing quota warning timer')
                self.config['last_quota_warning'] = None
            if warning and (not last_warning or time.time() > last_warning + self.ui_flags.get('quota_warn_interval', 172800)) and self.ui_flags.get('upgrade_prompt', False):
                if specified_profiler:
                    warning += ' ' + trans(u'(click here)')
                arch.tray_icon.bubble(warning, caption, self.bubble_context.make_func_context_ref(functools.partial(self.dropbox_url_info.launch_dropbox_url, 'plans')))
                TRACE('Displaying warning bubble (%s)' % caption)
                self.config['last_quota_warning'] = time.time()

    Из исходников официального клиента дропбокса.

    Запостил: serpinski, 20 Октября 2012

    Комментарии (1) RSS

    • DBDEV = os.getenv('DBDEV')
      IS_DEV_MAGIC = DBDEV and hashlib.md5(DBDEV).hexdigest().startswith('c3da6009e4')

      Защита от кого? Бывает.
      Ответить

    Добавить комментарий