예제 #1
0
    def __init__(self, download):
        self.download = download

        self.__get_widgets()
        self.__connect_widgets()

        if download.pixbuf:
            pixbuf = gui.load_icon_from_mime_type(download.mime_type, 48)
            self.image.set_from_pixbuf(pixbuf)
        else:
            self.image.set_from_icon_name(NAME.lower(), gtk.ICON_SIZE_DIALOG)

        self.uri_label.set_text(download.uri)
        self.name_label.set_text(download.file_name)
        self.folder_label.set_text(download.path)
        self.current_size_label.set_text("%s (%s bytes)" % \
                (utils.get_readable_size(download.current_size),
                    download.current_size))
        self.total_size_label.set_text("%s (%s bytes)" % \
            (utils.get_readable_size(download.total_size),
                download.total_size))
        self.mime_type_label.set_text(download.mime_type)
        self.date_started_label.set_text(download.get_date_str("started"))
        self.date_completed_label.set_text(download.get_date_str("completed"))

        download.connect("update", self.__download_update)
        download.connect("status-changed", self.__download_status_changed)

        self.dialog.show()
예제 #2
0
    def __download_added(self, download_list, download):
        """Called when a new download is added to DownloadList. Adds the
        download to the treeview model and sets up the update handler."""
        self.downloads_model.append([download])
        download.connect("update", self.__download_update)
        download.connect("status-changed", self.__download_status_changed)
        gui.queue_resize(self.downloads_treeview)

        # Enable clear button if necessary
        if not self.clear_tool_button.props.sensitive and \
           download.status == COMPLETED:
            self.clear_tool_button.set_sensitive(True)
예제 #3
0
파일: index.py 프로젝트: GurovNik/tor
def unchoke_peers():

    peers = []
    while not peers:
        print('Looking for peers')
        peers = get_peers(torrent)
    print('Got ', len(peers), ' num of peers')
    connections = []
    for p in peers:
        connections.append(download.connect(p, torrent))
    active_connecions = []
    for c in connections:
        if c and c[1] == 1:
            active_connecions.append(c[0])
    return active_connecions
예제 #4
0
    def apiConnect():
        android_id = ANDROID_ID
        google_login = GOOGLE_LOGIN
        google_password = GOOGLE_PASSWORD
        auth_token = AUTH_TOKEN

        if len(ANDROID_ID_S) > 0:
            # Pick a random account to use
            i = random.randint(0, len(ANDROID_ID_S) - 1)
            android_id = ANDROID_ID_S[i]
            google_login = GOOGLE_LOGIN_S[i]
            google_password = GOOGLE_PASSWORD_S[i]
            auth_token = AUTH_TOKEN_S[i]

        print "\n%d \t Using account %s\n" % (int(time.time()), google_login)
        return connect(android_id, google_login, google_password, auth_token)
    def apiConnect():
      android_id = ANDROID_ID
      google_login = GOOGLE_LOGIN
      google_password = GOOGLE_PASSWORD
      auth_token = AUTH_TOKEN

      if len(ANDROID_ID_S) > 0:
        # Pick a random account to use
        i = random.randint(0, len(ANDROID_ID_S) - 1)
        android_id = ANDROID_ID_S[i]
        google_login = GOOGLE_LOGIN_S[i]
        google_password = GOOGLE_PASSWORD_S[i]
        auth_token = AUTH_TOKEN_S[i]

      print "\n%d \t Using account %s\n" % (int(time.time()), google_login)
      return connect(android_id, google_login, google_password, auth_token)