def init_network(self): while True: try: self.auth_token = get_auth_token() self.note_store = get_note_store(self.auth_token) break except socket.error: time.sleep(30)
def __init__(self, verbose, *args, **kwargs): AppClass.__init__(self, *args, **kwargs) self.settings = QSettings('everpad', 'everpad-provider') self.verbose = verbose session_bus = dbus.SessionBus() self.bus = dbus.service.BusName("com.everpad.Provider", session_bus) self.service = ProviderService(session_bus, '/EverpadProvider') self.sync_thread = SyncThread() self.sync_thread.sync_state_changed.connect( Slot(int)(self.service.sync_state_changed), ) self.sync_thread.data_changed.connect( Slot()(self.service.data_changed), ) if get_auth_token(): self.sync_thread.start() self.service.qobject.authenticate_signal.connect( self.on_authenticated, ) self.service.qobject.remove_authenticate_signal.connect( self.on_remove_authenticated, ) self.service.qobject.terminate.connect(self.terminate)
def is_authenticated(self): return bool(get_auth_token())