def __init__(self, parent):
        if HPasteCollectionWidget.__instance is None:
            HPasteCollectionWidget.__instance = HPasteCollectionWidget.__HPasteCollectionWidget(parent)
            try:
                auths = []

                if True:
                    auths = list(GithubAuthorizator.listAuthorizations())
                ## test
                # todel = []
                # for auth in auths:
                #	if not GithubAuthorizator.testAuthorization(auth):
                #		if not GithubAuthorizator.newAuthorization(auth):
                #			todel.append(auth)
                # for d in todel:
                #	auths.remove(d)
                # For now don't force people to have their own collections
                while False and len(auths) == 0:
                    auths = list(GithubAuthorizator.listAuthorizations())
                    if len(auths) == 0:
                        if GithubAuthorizator.newAuthorization():
                            continue
                        else:
                            raise RuntimeError("No collections")
                    # test
                    todel = []
                    for auth in auths:
                        if not GithubAuthorizator.testAuthorization(auth):
                            if not GithubAuthorizator.newAuthorization(auth):
                                todel.append(auth)
                    for d in todel:
                        auths.remove(d)
            except Exception as e:
                hou.ui.displayMessage('Something went wrong.\n%s' % str(e))
                HPasteCollectionWidget.__instance = None
                raise

            for auth in auths:
                if auth['enabled']:
                    HPasteCollectionWidget.__instance.addCollection(GithubCollection(auth['token']), do_async=True)

            # now public collections
            cols = GithubAuthorizator.listPublicCollections()
            for col in cols:
                if not col['enabled']:
                    continue
                try:
                    # TODO: test if collection works
                    ptkn = None
                    if len(auths) > 0:
                        import random
                        ptkn = random.sample(auths, 1)[0]['token']
                    HPasteCollectionWidget.__instance.addCollection(GithubCollection(col['user'], public=True, token_for_public_access=ptkn), do_async=True)
                except Exception as e:
                    msg = ''
                    if isinstance(e, error.HTTPError):
                        msg = 'code %d. %s' % (e.code, e.reason)
                    elif isinstance(e, error.URLError):
                        msg = e.reason
                    else:
                        msg = str(e)
                    hou.ui.displayMessage('unable to load public collection %s: %s' % (col['user'], msg))

            # set callback
            GithubAuthorizator.registerCollectionChangedCallback((HPasteCollectionWidget.__instance, HPasteCollectionWidget.__HPasteCollectionWidget._authCallback))
        elif parent is not HPasteCollectionWidget.__instance.parent():
            log("reparenting", 0)
            HPasteCollectionWidget.__instance.setParent(parent)