Skip to content

Commit

Permalink
NXDRIVE-1672: Ensure Application.update_status() is passed an Engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël authored and BoboTiG committed May 24, 2019
1 parent db1f353 commit b6b9830
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/changes/4.1.3.md
Expand Up @@ -41,6 +41,7 @@ Changes in command line arguments:
- [NXDRIVE-1666](https://jira.nuxeo.com/browse/NXDRIVE-1666): Handle lock conflicts in DirectEdit
- [NXDRIVE-1667](https://jira.nuxeo.com/browse/NXDRIVE-1667): Filter out any error in `get_opened_files()`
- [NXDRIVE-1668](https://jira.nuxeo.com/browse/NXDRIVE-1668): Handle `TrashPermissionError` when moving a file to the trash
- [NXDRIVE-1672](https://jira.nuxeo.com/browse/NXDRIVE-1672): Ensure `Application.update_status()` is passed an Engine
- [NXDRIVE-1677](https://jira.nuxeo.com/browse/NXDRIVE-1677): [Windows] Copy-paste and rename a local file while Drive is running does not work
- [NXDRIVE-1682](https://jira.nuxeo.com/browse/NXDRIVE-1682): Make the updater more robust against inappropriate server response

Expand Down
15 changes: 9 additions & 6 deletions nxdrive/gui/application.py
Expand Up @@ -512,7 +512,7 @@ def _file_already_exists(self, oldpath: Path, newpath: Path) -> None:
newpath.unlink()

@pyqtSlot(object)
def dropped_engine(self, engine: "Engine") -> None:
def dropped_engine(self, engine: Engine) -> None:
# Update icon in case the engine dropped was syncing
self.change_systray_icon()

Expand Down Expand Up @@ -570,7 +570,7 @@ def refresh_conflicts(self, uid: str) -> None:
self.ignoreds_model.addFiles(self.api.get_unsynchronizeds(uid))

@pyqtSlot()
def show_conflicts_resolution(self, engine: "Engine") -> None:
def show_conflicts_resolution(self, engine: Engine) -> None:
""" Display the conflicts/errors window. """
self.refresh_conflicts(engine.uid)
self._window_root(self.conflicts_window).setEngine.emit(engine.uid)
Expand Down Expand Up @@ -622,7 +622,7 @@ def destroyed_filters_dialog(self) -> None:
self.filters_dlg = None

@pyqtSlot()
def show_filters(self, engine: "Engine") -> None:
def show_filters(self, engine: Engine) -> None:
if self.filters_dlg:
self.filters_dlg.close()
self.filters_dlg = None
Expand Down Expand Up @@ -722,7 +722,7 @@ def auth() -> None:
dialog.exec_()

@pyqtSlot(object)
def _connect_engine(self, engine: "Engine") -> None:
def _connect_engine(self, engine: Engine) -> None:
engine.syncStarted.connect(self.change_systray_icon)
engine.syncCompleted.connect(self.change_systray_icon)
engine.invalidAuthentication.connect(self.change_systray_icon)
Expand Down Expand Up @@ -1251,15 +1251,18 @@ def _handle_connection(self) -> None:
del con
log.info("Successfully closed server socket")

def update_status(self, engine: "Engine") -> None:
def update_status(self, engine: Engine) -> None:
"""
Update the systray status for synchronization,
conflicts/errors and software updates.
"""
sync_state = error_state = update_state = ""

if not isinstance(engine, Engine):
log.error(f"Need an Engine, got {engine!r}")
return

update_state = self.manager.updater.status
self.refresh_conflicts(engine.uid)

# Check synchronization state
if self.manager.restart_needed:
Expand Down

0 comments on commit b6b9830

Please sign in to comment.