diff --git a/docs/INSTALL.md b/docs/INSTALL.md index ae32059..9192686 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -1,6 +1,6 @@ # Installation steps -1) Ensure [OneDrive for Linux](https://abraunegg.github.io/) is installed based on [instructions](https://github.com/abraunegg/onedrive/blob/master/docs/INSTALL.md) for your distro. +1) Ensure [OneDrive for Linux](https://abraunegg.github.io/) is installed based on [instructions](https://github.com/abraunegg/onedrive/blob/master/docs/install.md) for your distro. 1) Ensure Python3 and [pip](https://pip.pypa.io/en/stable/installation/) are installed on your system. 1) Clone or download content this repository. 1) (Optional) Create and activate a Python virtual environment: diff --git a/src/main_window.py b/src/main_window.py index 78eab25..cfab2d0 100644 --- a/src/main_window.py +++ b/src/main_window.py @@ -297,11 +297,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): installed_client_version = re.search(r"(v[0-9.]+)", str(client_version_check)).group(1) installed_client_version_num = int(installed_client_version.replace("v", "").replace(".", "")) - installed_client_version_num = ( - installed_client_version_num - if len(str(installed_client_version_num)) > 3 - else installed_client_version_num * 10 - ) + installed_client_version_num = installed_client_version_num if len(str(installed_client_version_num)) > 3 else installed_client_version_num * 10 return installed_client_version, installed_client_version_num @@ -313,9 +309,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): latest_client_version = get_latest_client_version() installed_client_version = get_installed_client_version() - logging.debug( - f"[GUI] Client version check: Installed: {installed_client_version[0]} | Latest: {latest_client_version}" - ) + logging.debug(f"[GUI] Client version check: Installed: {installed_client_version[0]} | Latest: {latest_client_version}") if not installed_client_version: version_label_text = "OneDrive client not found!" @@ -327,8 +321,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): version_tooltip_text = "Unable to check for latest OneDrive client version!" elif installed_client_version[1] < min_supported_version: - version_label_text = 'Unsupported OneDrive client! Please upgrade it.' - version_tooltip_text = f"Your OneDrive Client version not supported! Please upgrade it. \n Installed: {installed_client_version[0]} \n Latest: {latest_client_version}" + version_label_text = ( + 'Unsupported OneDrive client! Please upgrade it.' + ) + version_tooltip_text = ( + f"Your OneDrive Client version not supported! Please upgrade it. \n Installed: {installed_client_version[0]} \n Latest: {latest_client_version}" + ) min_requirements_met = False elif latest_client_version not in installed_client_version[0]: @@ -359,12 +357,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): def onedrive_process_status(self): # Check OneDrive status and start/stop sync button. - pixmap_running = QPixmap(DIR_PATH + "/resources/images/icons8-green-circle-48.png").scaled( - 24, 24, Qt.KeepAspectRatio - ) - pixmap_stopped = QPixmap(DIR_PATH + "/resources/images/icons8-red-circle-48.png").scaled( - 24, 24, Qt.KeepAspectRatio - ) + pixmap_running = QPixmap(DIR_PATH + "/resources/images/icons8-green-circle-48.png").scaled(24, 24, Qt.KeepAspectRatio) + pixmap_stopped = QPixmap(DIR_PATH + "/resources/images/icons8-red-circle-48.png").scaled(24, 24, Qt.KeepAspectRatio) for profile_name in global_config: # Check if profile exists in profile_status_pages, if not add it @@ -400,15 +394,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): def autostart_monitor(self): # Auto-start sync if compatible version of OneDrive client is installed. for profile_name in global_config: - logging.debug( - f"[{profile_name}] Compatible client version found: {self.profile_status_pages[profile_name].pushButton_start.isEnabled()}" - ) + logging.debug(f"[{profile_name}] Compatible client version found: {self.profile_status_pages[profile_name].pushButton_start.isEnabled()}") logging.debug(f"[{profile_name}] Auto-sync enabled for profile: {global_config[profile_name]['auto_sync']}") - if ( - self.profile_status_pages[profile_name].pushButton_start.isEnabled() - and global_config[profile_name]["auto_sync"] == "True" - ): + if self.profile_status_pages[profile_name].pushButton_start.isEnabled() and global_config[profile_name]["auto_sync"] == "True": self.start_onedrive_monitor(profile_name) def start_onedrive_monitor(self, profile_name, options=""): @@ -506,11 +495,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): absolute_path = QFileInfo(file_path).absolutePath().replace(" ", "%20") relative_path_display = os.path.relpath(QFileInfo(file_path).absolutePath(), _sync_dir + os.path.sep) parent_dir = re.search(r".+/([^/]+)/.+$", file_path).group(1) - file_size = ( - QFileInfo(file_path + ".partial").size() - if QFileInfo(file_path).size() == 0 - else QFileInfo(file_path).size() - ) + file_size = QFileInfo(file_path + ".partial").size() if QFileInfo(file_path).size() == 0 else QFileInfo(file_path).size() file_size_human = humanize_file_size(file_size) file_name = QFileInfo(file_path).fileName() progress = data["progress"] @@ -556,9 +541,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): # Estimate final size of file before download completes # Adding 5% to progress as the OD client report status 5% behind. item_widget.set_label_1(file_operation) - item_widget.set_label_2( - f"{humanize_file_size(file_size)} of ~{humanize_file_size(int(file_size) / (int(progress) + 5) * 100)}" - ) + item_widget.set_label_2(f"{humanize_file_size(file_size)} of ~{humanize_file_size(int(file_size) / (int(progress) + 5) * 100)}") else: item_widget.set_label_1(file_operation) item_widget.set_label_2(f"{progress_data_human} of {file_size_human}") @@ -594,9 +577,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): # Estimate final size of file before download completes # Adding 5% to progress as the OD client report status 5% behind. myQCustomQWidget.set_label_1(file_operation) - myQCustomQWidget.set_label_2( - f"{humanize_file_size(file_size)} of ~{humanize_file_size(int(file_size) / (int(progress) + 5) * 100)}" - ) + myQCustomQWidget.set_label_2(f"{humanize_file_size(file_size)} of ~{humanize_file_size(int(file_size) / (int(progress) + 5) * 100)}") else: myQCustomQWidget.set_label_1(file_operation) myQCustomQWidget.set_label_2(f"{progress_data_human} of {file_size_human}") @@ -640,9 +621,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.lw.loginFrame.setUrl(QUrl(url)) # Wait for user to login and obtain response URL - self.lw.loginFrame.urlChanged.connect( - lambda: self.get_response_url(self.lw.loginFrame.url().toString(), profile) - ) + self.lw.loginFrame.urlChanged.connect(lambda: self.get_response_url(self.lw.loginFrame.url().toString(), profile)) def show_external_login(self, profile): # Show external login window @@ -661,9 +640,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.lw2.lineEdit_response_url.textChanged.connect(self.enable_login_button) - self.lw2.pushButton_login.clicked.connect( - lambda: self.get_response_url(self.lw2.lineEdit_response_url.text(), profile) - ) + self.lw2.pushButton_login.clicked.connect(lambda: self.get_response_url(self.lw2.lineEdit_response_url.text(), profile)) def enable_login_button(self): # Enable 'Save' button only when valid URL with login response code is provided. @@ -691,9 +668,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): response_reason = response["response"] if response_reason == "success": - self.profile_status_pages[profile_name].label_onedrive_status.setText( - "Login successful. Please, start sync manually." - ) + self.profile_status_pages[profile_name].label_onedrive_status.setText("Login successful. Please, start sync manually.") response_dialog = QMessageBox.information( self, diff --git a/src/ui/setup_wizard.ui b/src/ui/setup_wizard.ui index 940bca4..c28a53a 100644 --- a/src/ui/setup_wizard.ui +++ b/src/ui/setup_wizard.ui @@ -99,7 +99,7 @@ - <html><head/><body><p><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;">OneDrive Client for Linux does not seem to be installed. </span></p><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:19px; background-color:#272822;"><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;">Please install it by following </span><a href="https://github.com/abraunegg/onedrive/blob/master/docs/INSTALL.md"><span style=" font-family:'Hack'; text-decoration: underline; color:#960000;">instructions</span></a><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;"> for your distro. </span></pre></body></html> + <html><head/><body><p><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;">OneDrive Client for Linux does not seem to be installed. </span></p><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:19px; background-color:#272822;"><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;">Please install it by following </span><a href="https://github.com/abraunegg/onedrive/blob/master/docs/install.md"><span style=" font-family:'Hack'; text-decoration: underline; color:#960000;">instructions</span></a><span style=" font-family:'Droid Sans Mono','monospace','monospace','Droid Sans Fallback'; font-size:14px; color:#960000;"> for your distro. </span></pre></body></html> diff --git a/src/wizard.py b/src/wizard.py index 13b5777..745a7f3 100644 --- a/src/wizard.py +++ b/src/wizard.py @@ -156,7 +156,7 @@ class wizardPage_version_check(QWizardPage): self.label_5.setOpenExternalLinks(True) self.label_5.setText( "OneDrive Client for Linux does not seem to be installed. Please install it by following " - "instructions for your distro. " + "instructions for your distro. " ) layout = QVBoxLayout() @@ -171,18 +171,14 @@ class wizardPage_version_check(QWizardPage): client_version_check = subprocess.check_output([client_bin_path, "--version"], stderr=subprocess.STDOUT) installed_client_version = re.search(r"(v[0-9.]+)", str(client_version_check)).group(1) installed_client_version_num = int(installed_client_version.replace("v", "").replace(".", "")) - installed_client_version_num = ( - installed_client_version_num - if len(str(installed_client_version_num)) > 3 - else installed_client_version_num * 10 - ) + installed_client_version_num = installed_client_version_num if len(str(installed_client_version_num)) > 3 else installed_client_version_num * 10 min_supported_version_num = 2500 if installed_client_version_num < min_supported_version_num: logging.info(f"Unsupported OneDrive {installed_client_version} detected.") self.label_4.setOpenExternalLinks(True) self.label_4.setText( - f'OneDrive {installed_client_version} is not supported. Please upgrade it.' + f'OneDrive {installed_client_version} is not supported. Please upgrade it.' ) self.label_4.setStyleSheet("color: red;") self.label_5.hide() @@ -375,9 +371,7 @@ class wizardPage_create_shared_library(QWizardPage): self.obtain_sharepoint_site_list = MaintenanceWorker(profile_name, options) # Connect signals before starting the worker - self.obtain_sharepoint_site_list.update_sharepoint_site_list.connect( - self.populate_comboBox_sharepoint_site_list - ) + self.obtain_sharepoint_site_list.update_sharepoint_site_list.connect(self.populate_comboBox_sharepoint_site_list) # Process events to ensure UI stays responsive from PySide6.QtCore import QCoreApplication @@ -426,9 +420,7 @@ class wizardPage_create_shared_library(QWizardPage): self.pushButton_get_libraries.setDisabled(True) self.comboBox_sharepoint_site_list.setDisabled(True) - logging.info( - f"[GUI] Starting maintenance worker to obtain SharePoint Library Drive ID for library {library_name} from profile {profile_name}." - ) + logging.info(f"[GUI] Starting maintenance worker to obtain SharePoint Library Drive ID for library {library_name} from profile {profile_name}.") self.obtain_library_drive_ids = MaintenanceWorker(profile_name, options) self.obtain_library_drive_ids.start() diff --git a/src/workers.py b/src/workers.py index f42e6fe..0f9c01b 100644 --- a/src/workers.py +++ b/src/workers.py @@ -264,8 +264,7 @@ class WorkerThread(QThread): elif "sync_business_shared_folders" in stdout: self.profile_status["status_message"] = ( - "Business Shared Folder " - ' has been deprecated.' + 'Business Shared Folder has been deprecated.' ) self.update_profile_status.emit(self.profile_status, self.profile_name) @@ -280,11 +279,11 @@ class WorkerThread(QThread): elif "command not found" in stdout: logging.error( """Onedrive does not seem to be installed. Please install it as per instruction at - https://github.com/abraunegg/onedrive/blob/master/docs/INSTALL.md """ + https://github.com/abraunegg/onedrive/blob/master/docs/install.md """ ) self.profile_status["status_message"] = ( - 'OneDrive Client not found! Please install it.' + 'OneDrive Client not found! Please install it.' ) self.update_profile_status.emit(self.profile_status, self.profile_name)