Exemplo n.º 1
0
  def build(self):
    # Can't import Window at the top or it will open early with default config.
    from kivy.core.window import Window
    Window.bind(on_key_down=self.on_key_down)

    access_token = self.config.get('put.io', 'access_token')
    if not access_token:
      Clock.schedule_once(lambda dt: self.show_settings(), 0)
      open_path('http://fetcher.codi.st/api/auth')

    Clock.schedule_once(lambda dt: self.apply_config(), 0)
Exemplo n.º 2
0
  def init(download):
    if download.id in downloads: return
    if download.path:
      row = LocalDownloadRow()
      row.browse.bind(on_press=lambda wgt: browse_path(download.path))
      row.play.bind(on_press=lambda wgt: open_path(download.path))
      row.close.bind(on_press=lambda wgt: remove_download(download))
    else:
      row = DownloadRow()
    row.state = 'pending'
    row.name = download.label
    if len(row.name) >= 40:
      row.name = row.name[:40] + u'\u2026'
    row.path = download.path
    app.root.downloads.add_widget(row)
    downloads[download.id] = download, row
    Clock.schedule_once(lambda dt: remove_download(download), 60*60*24)

    app.autosize()