Skip to content

Commit

Permalink
fixup! Extract state package from GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalo-bulnes committed Jan 11, 2022
1 parent 079c7bb commit d0bcb6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
QWidget,
)

from securedrop_client import state
from securedrop_client.db import (
DraftReply,
File,
Expand Down Expand Up @@ -2330,10 +2331,10 @@ def _set_file_name(self) -> None:
self.horizontal_line.hide()
self.spacer.show()

@pyqtSlot(str)
def _on_file_download_started(self, file_uuid: str) -> None:
if file_uuid == self.uuid:
logger.debug(f"Starting animation: {file_uuid}")
@pyqtSlot(state.FileId)
def _on_file_download_started(self, id: state.FileId) -> None:
if str(id) == self.uuid:
logger.debug(f"Starting animation: {id}")
self.downloading = True
QTimer.singleShot(300, self.start_button_animation)

Expand Down
4 changes: 2 additions & 2 deletions securedrop_client/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ class Controller(QObject):
This signal indicates that a file download has been started.
Emits:
str: the file UUID
FileId: the file UUID
"""
file_download_started = pyqtSignal(str)
file_download_started = pyqtSignal(state.FileId)

"""
This signal indicates that a file has been successfully downloaded.
Expand Down
2 changes: 1 addition & 1 deletion securedrop_client/state/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def set_selected_conversation(self, id: ConversationId) -> None:
if id not in self._state._conversations:
self.upsert_conversation(id, [])
self._state._selected_conversation = id
logger.debug("selected source/convesation:", id)
logger.debug(f"selected source/conversation: {id}")

def upsert_conversation(
self, id: ConversationId, files: List[Union[FileId, DownloadedFileId]]
Expand Down

0 comments on commit d0bcb6e

Please sign in to comment.