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 break
else: else:
dialog_location = Path.home() dialog_location = Path.home()
selected_location = QtWidgets.QFileDialog.getExistingDirectory(parent=self,caption="Select Location", selected_location = QtWidgets.QFileDialog.getExistingDirectory(parent=self,caption="Select Location",
directory=str(dialog_location), directory=str(dialog_location),
options=(QtWidgets.QFileDialog.ShowDirsOnly)) options=(QtWidgets.QFileDialog.ShowDirsOnly))
self.install_location.clear() self.install_location.setText(selected_location)
self.install_location.insert(selected_location)
def _requirements_check(self): def _requirements_check(self):
"""Checks that the minimum system requirements are met. Opens error message and resets the wizard if they are not. """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 from PyQt5 import QtCore, QtGui, QtWidgets
import psutil import psutil
import os import os
import pathlib
import platform import platform
from pathlib import Path from pathlib import Path
@@ -26,8 +25,7 @@ class Location_Validator(QtGui.QValidator):
Arguments: Arguments:
location {str} -- A string representing a folder path 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 (Path(drive.mountpoint) in Path(location).parents and drive.fstype.lower() == "ntfs")]
match = [drive for drive in psutil.disk_partitions() if (drive.mountpoint in parent_dirs and drive.fstype.lower() == "ntfs")]
if match: if match:
self._ntfs_location_selected = True self._ntfs_location_selected = True
return True return True
@@ -35,7 +33,7 @@ class Location_Validator(QtGui.QValidator):
# pass # pass
else: else:
self._ntfs_location_selected = False 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 return False
else: else:
return True return True