Pass a store dir path to nio HttpClient

This commit is contained in:
miruka 2019-05-06 22:42:48 -04:00
parent 9023d28c43
commit 15da828c70
3 changed files with 14 additions and 6 deletions

View File

@ -4,6 +4,7 @@
- Cleanup unused icons - Cleanup unused icons
- Bug fixes - Bug fixes
- Something weird happening when nio store is created first time
- 100% CPU usage when hitting top edge to trigger messages loading - 100% CPU usage when hitting top edge to trigger messages loading
- Sending `![A picture](https://picsum.photos/256/256)` → not clickable? - Sending `![A picture](https://picsum.photos/256/256)` → not clickable?
- Icons, images and HStyle singleton aren't reloaded - Icons, images and HStyle singleton aren't reloaded

View File

@ -6,7 +6,9 @@ from concurrent.futures import ThreadPoolExecutor
from threading import Event from threading import Event
from typing import DefaultDict, Tuple from typing import DefaultDict, Tuple
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot from PyQt5.QtCore import (
QObject, QStandardPaths, pyqtProperty, pyqtSignal, pyqtSlot
)
import nio import nio
@ -43,13 +45,19 @@ class Client(QObject):
self.pool: ThreadPoolExecutor = ThreadPoolExecutor(6) self.pool: ThreadPoolExecutor = ThreadPoolExecutor(6)
self.nio: nio.client.HttpClient = \ store_path = self.manager.backend.getDir(
nio.client.HttpClient(self.host, username, device_id) QStandardPaths.AppDataLocation
)
self.nio: nio.client.HttpClient = nio.client.HttpClient(
self.host, username, device_id, store_path=store_path
)
# Since nio clients can't handle more than one talk operation # Since nio clients can't handle more than one talk operation
# at a time, this one is used exclusively to poll the sync API # at a time, this one is used exclusively to poll the sync API
self.nio_sync: nio.client.HttpClient = \ self.nio_sync: nio.client.HttpClient = nio.client.HttpClient(
nio.client.HttpClient(self.host, username, device_id) self.host, username, device_id, store_path=store_path
)
self.net = NetworkManager(self.host, self.port, self.nio) self.net = NetworkManager(self.host, self.port, self.nio)
self.net_sync = NetworkManager(self.host, self.port, self.nio_sync) self.net_sync = NetworkManager(self.host, self.port, self.nio_sync)

View File

@ -40,7 +40,6 @@ HGlassRectangle {
area.onEditingFinished: setTyping(false) // when lost focus area.onEditingFinished: setTyping(false) // when lost focus
Keys.onReturnPressed: { Keys.onReturnPressed: {
console.log( "enter")
event.accepted = true event.accepted = true
if (event.modifiers & Qt.ShiftModifier || if (event.modifiers & Qt.ShiftModifier ||