diff --git a/dangerzone/__init__.py b/dangerzone/__init__.py index a137202..902d49a 100644 --- a/dangerzone/__init__.py +++ b/dangerzone/__init__.py @@ -55,7 +55,7 @@ def main(filename): return # See if we need to install Docker... - if platform.system() == "Darwin" and ( + if (platform.system() == "Darwin" or platform.system() == "Windows") and ( not is_docker_installed(common) or not is_docker_ready(common) ): print("Docker is either not installed or not running") @@ -63,30 +63,6 @@ def main(filename): docker_installer.start() return - if platform.system() == "Windows": - if not is_docker_installed(common): - print("Docker is not installed") - docker_installer = DockerInstaller(common) - docker_installer.start() - # Quit after the installer runs, because it requires rebooting - return - - if not is_docker_ready(common): - print("Docker is not running") - launch_docker_windows(common) - - # Wait up to 20 minutes for docker to be ready - for i in range(120): - if is_docker_ready(common): - main(filename) - return - - print("Waiting for docker to be available ...") - time.sleep(1) - - # Give up - print("Docker not available, giving up") - # Main window main_window = MainWindow(common) diff --git a/dangerzone/docker_installer.py b/dangerzone/docker_installer.py index b439215..f2401cd 100644 --- a/dangerzone/docker_installer.py +++ b/dangerzone/docker_installer.py @@ -52,7 +52,7 @@ class DockerInstaller(QtWidgets.QDialog): self.setWindowTitle("dangerzone") self.setWindowIcon(self.common.get_window_icon()) - self.setMinimumHeight(160) + self.setMinimumHeight(170) label = QtWidgets.QLabel() if platform.system() == "Darwin": @@ -148,11 +148,11 @@ class DockerInstaller(QtWidgets.QDialog): self.reject() if self.download_t: + self.download_t.quit() try: os.remove(self.installer_filename) except: pass - self.download_t.quit() def open_finder_clicked(self): if platform.system() == "Darwin": @@ -164,7 +164,12 @@ class DockerInstaller(QtWidgets.QDialog): self.accept() def start(self): - if not os.path.isdir("/Applications/Docker.app"): + if platform.system() == "Darwin": + docker_app_path = "/Applications/Docker.app" + else: + docker_app_path = "C:\\Program Files\\Docker\\Docker\\Docker Desktop.exe" + + if not os.path.exists(docker_app_path): self.download() else: self.task_label.setText( @@ -173,7 +178,7 @@ class DockerInstaller(QtWidgets.QDialog): self.progress.hide() self.cancel_button.hide() - self.open_finder_path = "/Applications/Docker.app" + self.open_finder_path = docker_app_path self.open_finder_button.show() return self.exec_() == QtWidgets.QDialog.Accepted