some cleanup

This commit is contained in:
Brennen Raimer
2019-05-06 23:37:00 -04:00
parent 9280a7b7cf
commit ea96dd3669
2 changed files with 4 additions and 6 deletions

View File

@@ -84,11 +84,11 @@ class InstallerWizard(QtWidgets.QWizard):
break
else:
dialog_location = Path.home()
selected_location = QtWidgets.QFileDialog.getExistingDirectory(parent=self,caption="Select Location",
directory=str(dialog_location),
options=(QtWidgets.QFileDialog.ShowDirsOnly))
self.install_location.clear()
self.install_location.insert(selected_location)
self.install_location.setText(selected_location)
def _requirements_check(self):
"""Checks that the minimum system requirements are met. Opens error message and resets the wizard if they are not.

View File

@@ -1,7 +1,6 @@
from PyQt5 import QtCore, QtGui, QtWidgets
import psutil
import os
import pathlib
import platform
from pathlib import Path
@@ -26,8 +25,7 @@ class Location_Validator(QtGui.QValidator):
Arguments:
location {str} -- A string representing a folder path
"""
parent_dirs = [str(parent_dir) for parent_dir in pathlib.Path(location).parents]
match = [drive for drive in psutil.disk_partitions() if (drive.mountpoint in parent_dirs and drive.fstype.lower() == "ntfs")]
match = [drive for drive in psutil.disk_partitions() if (Path(drive.mountpoint) in Path(location).parents and drive.fstype.lower() == "ntfs")]
if match:
self._ntfs_location_selected = True
return True
@@ -35,7 +33,7 @@ class Location_Validator(QtGui.QValidator):
# pass
else:
self._ntfs_location_selected = False
if QtWidgets.QMessageBox.question(self.parent(), "", f"{pathlib.Path(location)} is not an NTFS-formatted volume. Tools which require a NTFS filesystem to function will not be available. Continue anyway?") in (QtWidgets.QMessageBox.No, 0):
if QtWidgets.QMessageBox.question(self.parent(), "", f"{Path(location)} is not an NTFS-formatted volume. Tools which require a NTFS filesystem to function will not be available. Continue anyway?") in (QtWidgets.QMessageBox.No, 0):
return False
else:
return True