diff --git a/OneDriveGUI/OneDriveGUI.py b/OneDriveGUI/OneDriveGUI.py index 19bd3f1..cf71d65 100644 --- a/OneDriveGUI/OneDriveGUI.py +++ b/OneDriveGUI/OneDriveGUI.py @@ -5,6 +5,7 @@ import re import subprocess import sys +import time from configparser import ConfigParser from PySide6.QtCore import QThread, QTimer, QUrl, Signal, QFileInfo, Qt @@ -54,6 +55,7 @@ def __init__(self): self.listWidget_profiles.itemSelectionChanged.connect(self.switch_account_settings_page) self.pushButton_open_create.clicked.connect(self.create_new_profile_window) self.pushButton_open_import.clicked.connect(self.import_profile_window) + self.pushButton_remove.clicked.connect(self.remove_profile) self.show() def switch_account_settings_page(self): @@ -84,9 +86,34 @@ def import_profile_window(self): self.import_ui.pushButton_import.clicked.connect(self.import_profile) # Hide window once account is created - self.import_ui.pushButton_import.clicked.connect(self.import_window.hide) + self.import_ui.pushButton_import.clicked.connect(self.import_window.hide) + def remove_profile(self): + # Remove profile from settings window. + selected_profile_name = self.listWidget_profiles.currentItem().text() + selected_profile_index = self.listWidget_profiles.currentRow() + selected_profile_widget = self.stackedLayout.currentWidget() + self.listWidget_profiles.takeItem(selected_profile_index) + self.stackedLayout.removeWidget(selected_profile_widget) + + # Remove profile from main window. + combo_box_index = main_window.comboBox.findText(selected_profile_name) + main_window.comboBox.removeItem(combo_box_index) + main_window.profile_status_pages.pop(selected_profile_name, None) + global_config.pop(selected_profile_name, None) + print(global_config) + + # Load existing user profiles and remove the new profile. + _profiles = ConfigParser() + _profiles.read(PROFILES_FILE) + _profiles.remove_section(selected_profile_name) + + # Save the new profile. + with open(PROFILES_FILE, 'w') as profilefile: + _profiles.write(profilefile) + + def create_profile(self): """ Creates new profile and loads default settings. @@ -114,19 +141,28 @@ def create_profile(self): _profiles.read(PROFILES_FILE) _profiles[profile_name] = new_profile[profile_name] - with open(PROFILES_FILE, 'w') as configfile: - _profiles.write(configfile) + # Create profile config file if it does not exist. + profiles_dir = re.search(r"(.+)/profiles$", PROFILES_FILE).group(1) + if not os.path.exists(profiles_dir): + os.makedirs(profiles_dir) + + # Save the new profile. + with open(PROFILES_FILE, 'w') as profilefile: + _profiles.write(profilefile) # Append default OD config new_profile[profile_name].update(default_od_config) # Configure sync directory - new_profile[profile_name]['onedrive']['sync_dir'] = sync_dir + new_profile[profile_name]['onedrive']['sync_dir'] = f'"{sync_dir}"' # Append new profile into running global profile global_config.update(new_profile) + # Automatically save global config to prevent loss if user does not press 'Save' button. + save_global_config() + # Add Setting page widget for new profile self.listWidget_profiles.addItem(profile_name) self.page = ProfileSettingsPage(profile_name) @@ -135,8 +171,10 @@ def create_profile(self): # Add status page widget for new profile main_window.comboBox.addItem(profile_name) main_window.profile_status_pages[profile_name] = ProfileStatusPage(profile_name) - main_window.stackedLayout.addWidget(main_window.profile_status_pages[profile_name]) + main_window.stackedLayout.addWidget(main_window.profile_status_pages[profile_name]) + # Hide "Create profile" push button from main windows. + main_window.pushButton_new_profile.hide() @@ -173,6 +211,12 @@ def import_profile(self): _profiles.read(PROFILES_FILE) _profiles[profile_name] = new_profile[profile_name] + # Create profile config file if it does not exist. + profiles_dir = re.search(r"(.+)/profiles$", PROFILES_FILE).group(1) + if not os.path.exists(profiles_dir): + os.makedirs(profiles_dir) + + # Save the new profile. with open(PROFILES_FILE, 'w') as configfile: _profiles.write(configfile) @@ -191,7 +235,8 @@ def import_profile(self): self.page = ProfileSettingsPage(profile_name) self.stackedLayout.addWidget(self.page) - + # Hide "Create profile" push button from main windows. + main_window.pushButton_new_profile.hide() class ProfileStatusPage(QWidget, Ui_status_page): @@ -204,6 +249,15 @@ def __init__(self, profile): # Show selected profile name self.label_4.setText(profile) + # Temporary start/stop buttons + self.toolButton_start.clicked.connect(lambda: main_window.start_onedrive_monitor(profile)) + self.toolButton_stop.clicked.connect(lambda: main_window.workers[profile].stop_worker()) + # self.toolButton_stop.clicked.connect(lambda: main_window.workers[profile].exit()) + # self.toolButton_stop.clicked.connect(lambda: main_window.workers[profile].quit()) + # self.toolButton_stop.clicked.connect(lambda: main_window.workers[profile].terminate()) + # self.toolButton_stop.clicked.connect(lambda: main_window.workers.pop(profile, None)) + + # # Open Settings window self.pushButton_settings.clicked.connect(self.show_settings_window) @@ -215,6 +269,9 @@ def show_settings_window(self): self.settings_window = SettingsWindow() self.settings_window.show() + # def stop_worker(self, profile): + # main_window.workers[profile].onedrive_process.kill() + class ProfileSettingsPage(QWidget, Ui_profile_settings): def __init__(self, profile): @@ -392,6 +449,16 @@ def __init__(self, profile): self.spinBox_min_notify_changes.setValue(int(self.temp_profile_config['min_notify_changes'].strip('"'))) self.spinBox_min_notify_changes.valueChanged.connect(self.set_spin_box_value) + # + # Account tab + # + self.config_file = global_config[self.profile]['config_file'].strip('"') + self.config_dir = re.search(r"(.+)/.+$", self.config_file).group(1) + + self.pushButton_login.clicked.connect(lambda: main_window.show_login(self.profile)) + self.pushButton_logout.clicked.connect(lambda: os.system(f"onedrive --confdir='{self.config_dir}' --logout")) + self.pushButton_logout.clicked.connect(lambda: print(f"Profile {self.profile} has been logged out.")) + # # Buttons # @@ -523,7 +590,7 @@ def hide_progress_bar(self, transfer_status: bool): class WorkerThread(QThread): - update_credentials = Signal() + update_credentials = Signal(str) update_progress = Signal(dict) update_progress_new = Signal(dict, str) trigger_resync = Signal() @@ -540,6 +607,23 @@ def __init__(self, profile): # print(f"command is: {self._command}") self._profile_name = profile + def stop_worker(self): + print(f"[{self._profile_name}] Waiting for worker to finish...") + while self.onedrive_process.poll() is None: + self.onedrive_process.kill() + time.sleep(1) + + print(f"[{self._profile_name}] Quiting thread") + self.quit() + self.wait() + print(f"[{self._profile_name}] Removing thread info") + main_window.workers.pop(self._profile_name, None) + print(f"Remaining running workers: {main_window.workers}") + + + + + def run(self, resync=False): matches = ['Downloading file', 'Downloading new file', 'Uploading file', 'Uploading new file', 'Uploading modified file', 'Downloading modified file'] @@ -562,7 +646,7 @@ def run(self, resync=False): if 'Authorize this app visiting' in stdout: self.onedrive_process.kill() - self.update_credentials.emit() + self.update_credentials.emit(self._profile_name) elif any(x in stdout for x in matches): # capture file uploads and downloads # self.tray.setIcon(QIcon("resources/images/icons8-cloud-sync-40_2.png")) @@ -640,6 +724,8 @@ def run(self, resync=False): print('@@ERROR' + stderr) + + class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self): @@ -649,9 +735,19 @@ def __init__(self): self.setupUi(self) self.setWindowIcon(QIcon("resources/images/icons8-clouds-48.png")) + if len(global_config) == 0: + # self.pushButton_new_profile.clicked.connect(self.show_settings_window) + # self.pushButton_new_profile.show() + self.show_settings_window() + + # else: + self.pushButton_new_profile.hide() + # # Menu # + + self.menubar.hide() # Update OneDrive Status self.actionRefresh_Service_Status.triggered.connect(lambda: self.onedrive_process_status()) @@ -712,6 +808,10 @@ def __init__(self): else: self.tray = None + def show_settings_window(self): + self.settings_window = SettingsWindow() + self.settings_window.show() + def switch_account_status_page(self): self.stackedLayout.setCurrentIndex(self.comboBox.currentIndex()) @@ -743,12 +843,17 @@ def onedrive_sync_status(self): def start_onedrive_monitor(self, profile_name): # for profile in global_config: - self.workers[profile_name] = WorkerThread(profile_name) - self.workers[profile_name].start() + + if profile_name not in self.workers: + self.workers[profile_name] = WorkerThread(profile_name) + self.workers[profile_name].start() + else: + print(f"Worker for profile {profile_name} is already running. Please stop it first.") + print(f"Running workers: {main_window.workers}") # self.worker = WorkerThread() # self.worker.start() - # self.worker.update_credentials.connect(self.show_login) + self.workers[profile_name].update_credentials.connect(self.show_login) # self.worker.update_progress.connect(self.event_update_progress) # self.worker.trigger_resync.connect(self.show_login) self.workers[profile_name].update_progress_new.connect(self.event_update_progress_new) @@ -795,7 +900,7 @@ def event_update_progress_new(self, data, profile): print(data) file_path = f'{_sync_dir}' + "/" + data['file_path'] - absolute_path = QFileInfo(file_path).absolutePath() + absolute_path = QFileInfo(file_path).absolutePath().replace(' ','%20') parent_dir = re.search(r".+/([^/]+)/.+$", file_path) file_size = QFileInfo(file_path).size() file_size_human = humanize_file_size(file_size) @@ -888,7 +993,7 @@ def event_update_progress_new(self, data, profile): self.profile_status_pages[profile].listWidget.setItemWidget(myQListWidgetItem, myQCustomQWidget) - def show_login(self): + def show_login(self, profile): # Show login window self.window1 = QWidget() self.window1.setWindowIcon(QIcon("resources/images/icons8-clouds-48.png")) @@ -896,6 +1001,9 @@ def show_login(self): self.lw.setupUi(self.window1) self.window1.show() + self.config_file = global_config[profile]['config_file'].strip('"') + self.config_dir = re.search(r"(.+)/.+$", self.config_file).group(1) + # use static URL for now. TODO: use auth files in the future url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=d50ca740-c83f-4d1b-b616' \ '-12c519384f0c&scope=Files.ReadWrite%20Files.ReadWrite.all%20Sites.Read.All%20Sites.ReadWrite.All' \ @@ -904,18 +1012,21 @@ def show_login(self): 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())) + self.lw.loginFrame.urlChanged.connect(lambda: self.get_response_url(self.lw.loginFrame.url().toString(), self.config_dir, profile)) - def get_response_url(self, response_url): + def get_response_url(self, response_url, config_dir, profile): # Get response URL from OneDrive OAuth2 if 'nativeclient?code=' in response_url: - os.system(f'onedrive --auth-response "{response_url}"') + print(f'onedrive --confdir="{config_dir}" --auth-response "{response_url}"') + os.system(f'onedrive --confdir="{config_dir}" --auth-response "{response_url}"') print("Login performed") self.window1.hide() + main_window.workers[profile].onedrive_process.kill() else: pass + def read_config(config_file): with open(config_file, 'r') as f: config_string = '[onedrive]\n' + f.read() diff --git a/OneDriveGUI/resources/default_config b/OneDriveGUI/resources/default_config index 545f9c0..f12a3fd 100644 --- a/OneDriveGUI/resources/default_config +++ b/OneDriveGUI/resources/default_config @@ -28,7 +28,6 @@ remove_source_files = "false" skip_dir_strict_match = "false" application_id = "" resync = "false" -resync_auth = "false" bypass_data_preservation = "false" azure_ad_endpoint = "" azure_tenant_id = "common" @@ -42,4 +41,4 @@ webhook_public_url = "" webhook_listening_host = "" webhook_listening_port = "8888" webhook_expiration_interval = "86400" -webhook_renewal_interval = "43200" \ No newline at end of file +webhook_renewal_interval = "43200" diff --git a/OneDriveGUI/resources/images/icons8-green-circle-48.png b/OneDriveGUI/resources/images/icons8-green-circle-48.png new file mode 100644 index 0000000..7d21009 Binary files /dev/null and b/OneDriveGUI/resources/images/icons8-green-circle-48.png differ diff --git a/OneDriveGUI/resources/images/icons8-red-circle-48.png b/OneDriveGUI/resources/images/icons8-red-circle-48.png new file mode 100644 index 0000000..0b8c63c Binary files /dev/null and b/OneDriveGUI/resources/images/icons8-red-circle-48.png differ diff --git a/OneDriveGUI/ui/mainwindow.ui b/OneDriveGUI/ui/mainwindow.ui index 8052ab5..78efc7d 100644 --- a/OneDriveGUI/ui/mainwindow.ui +++ b/OneDriveGUI/ui/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 497 - 808 + 420 + 807 @@ -36,8 +36,50 @@ + + 0 + + + + + + 10 + 75 + true + + + + Qt::DefaultContextMenu + + + background-color: rgb(0, 120, 212); +color: rgb(255, 255, 255); + + + - + + + + + + 9999 + 9999 + + + + Qt::LeftToRight + + + alignment=Qt.AlignCenter + + + + Create/ Import OneDrive profile + + + + @@ -48,7 +90,7 @@ 0 0 - 497 + 420 30 diff --git a/OneDriveGUI/ui/process_status_page.ui b/OneDriveGUI/ui/process_status_page.ui index 2073c04..50de7d5 100644 --- a/OneDriveGUI/ui/process_status_page.ui +++ b/OneDriveGUI/ui/process_status_page.ui @@ -11,7 +11,7 @@ - Form + OneDriveGUI - Process Status @@ -34,7 +34,7 @@ 0 - 100 + 80 @@ -47,15 +47,63 @@ QFrame::Raised + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Start + + + + + color: rgb(255, 255, 255); + ... - + + + + + 11 + 75 + true + + + + color: rgb(255, 255, 255); + + + Onedrive is ... + + + Qt::AlignCenter + + + + + + color: rgb(255, 255, 255); + ... @@ -64,13 +112,10 @@ - - + + - Onedrive is ... - - - Qt::AlignCenter + Stop diff --git a/OneDriveGUI/ui/profile_settings_page.ui b/OneDriveGUI/ui/profile_settings_page.ui index 7996d83..4982af6 100644 --- a/OneDriveGUI/ui/profile_settings_page.ui +++ b/OneDriveGUI/ui/profile_settings_page.ui @@ -6,14 +6,20 @@ 0 0 - 614 + 664 723 - Form + OneDriveGUI - Profile Settings + + 0 + + + 0 + @@ -37,12 +43,12 @@ - 600 + 650 600 - 2 + 5 @@ -577,47 +583,47 @@ - + Enable Logging - - - - Browse - - - - + Log location: - + Debug HTTPS - - - - + - + + + + Browse + + + + Monitor log frequency + + + @@ -767,8 +773,24 @@ - GUI Behaviour + Account + + + + + Login + + + + + + + Logout + + + + diff --git a/OneDriveGUI/ui/settings.ui b/OneDriveGUI/ui/settings.ui index 74df412..e0c8442 100644 --- a/OneDriveGUI/ui/settings.ui +++ b/OneDriveGUI/ui/settings.ui @@ -6,20 +6,23 @@ 0 0 - 601 - 817 + 272 + 765 - Form + OneDriveGUI - Settings + + 6 + - + Profiles: diff --git a/OneDriveGUI/ui/ui_mainwindow.py b/OneDriveGUI/ui/ui_mainwindow.py index 213e30a..d576d90 100644 --- a/OneDriveGUI/ui/ui_mainwindow.py +++ b/OneDriveGUI/ui/ui_mainwindow.py @@ -17,13 +17,14 @@ QPainter, QPalette, QPixmap, QRadialGradient, QTransform) from PySide6.QtWidgets import (QApplication, QComboBox, QMainWindow, QMenu, - QMenuBar, QSizePolicy, QVBoxLayout, QWidget) + QMenuBar, QPushButton, QSizePolicy, QVBoxLayout, + QWidget) class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") - MainWindow.resize(497, 808) + MainWindow.resize(420, 807) icon = QIcon() icon.addFile(u"../../../OneDriveGUI_POC_recovered-multi/icons8-clouds-48.png", QSize(), QIcon.Normal, QIcon.Off) MainWindow.setWindowIcon(icon) @@ -56,19 +57,41 @@ def setupUi(self, MainWindow): self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2 = QVBoxLayout() + self.verticalLayout_2.setSpacing(0) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.comboBox = QComboBox(self.centralwidget) self.comboBox.setObjectName(u"comboBox") + font = QFont() + font.setPointSize(10) + font.setBold(True) + self.comboBox.setFont(font) + self.comboBox.setContextMenuPolicy(Qt.DefaultContextMenu) + self.comboBox.setStyleSheet(u"background-color: rgb(0, 120, 212);\n" +"color: rgb(255, 255, 255);") self.verticalLayout_2.addWidget(self.comboBox) + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.pushButton_new_profile = QPushButton(self.centralwidget) + self.pushButton_new_profile.setObjectName(u"pushButton_new_profile") + self.pushButton_new_profile.setMaximumSize(QSize(9999, 9999)) + self.pushButton_new_profile.setLayoutDirection(Qt.LeftToRight) + self.pushButton_new_profile.setStyleSheet(u"alignment=Qt.AlignCenter\n" +"") + + self.verticalLayout_3.addWidget(self.pushButton_new_profile) + + + self.verticalLayout_2.addLayout(self.verticalLayout_3) + self.verticalLayout.addLayout(self.verticalLayout_2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 497, 30)) + self.menubar.setGeometry(QRect(0, 0, 420, 30)) self.menuAdvanced = QMenu(self.menubar) self.menuAdvanced.setObjectName(u"menuAdvanced") self.menuDebug = QMenu(self.menuAdvanced) @@ -117,6 +140,7 @@ def retranslateUi(self, MainWindow): self.actionObtain_Sync_Status.setText(QCoreApplication.translate("MainWindow", u"Obtain Sync Status", None)) self.actionTest_Service.setText(QCoreApplication.translate("MainWindow", u"Test Service", None)) self.actionstart.setText(QCoreApplication.translate("MainWindow", u"start", None)) + self.pushButton_new_profile.setText(QCoreApplication.translate("MainWindow", u"Create/ Import OneDrive profile", None)) self.menuAdvanced.setTitle(QCoreApplication.translate("MainWindow", u"Advanced", None)) self.menuDebug.setTitle(QCoreApplication.translate("MainWindow", u"Debug", None)) self.menuService.setTitle(QCoreApplication.translate("MainWindow", u"Service", None)) diff --git a/OneDriveGUI/ui/ui_process_status_page.py b/OneDriveGUI/ui/ui_process_status_page.py index 8903c05..761d32b 100644 --- a/OneDriveGUI/ui/ui_process_status_page.py +++ b/OneDriveGUI/ui/ui_process_status_page.py @@ -17,7 +17,8 @@ QPalette, QPixmap, QRadialGradient, QTransform) from PySide6.QtWidgets import (QAbstractItemView, QApplication, QFrame, QGridLayout, QHBoxLayout, QLabel, QListWidget, QListWidgetItem, - QPushButton, QSizePolicy, QVBoxLayout, QWidget) + QPushButton, QSizePolicy, QToolButton, QVBoxLayout, + QWidget) class Ui_status_page(object): def setupUi(self, status_page): @@ -30,28 +31,47 @@ def setupUi(self, status_page): self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.frame = QFrame(status_page) self.frame.setObjectName(u"frame") - self.frame.setMinimumSize(QSize(0, 100)) + self.frame.setMinimumSize(QSize(0, 80)) self.frame.setStyleSheet(u"background-color: rgb(0, 120, 212);") self.frame.setFrameShape(QFrame.StyledPanel) self.frame.setFrameShadow(QFrame.Raised) self.gridLayout = QGridLayout(self.frame) + self.gridLayout.setSpacing(2) self.gridLayout.setObjectName(u"gridLayout") + self.gridLayout.setContentsMargins(2, 2, 2, 2) + self.toolButton_start = QToolButton(self.frame) + self.toolButton_start.setObjectName(u"toolButton_start") + + self.gridLayout.addWidget(self.toolButton_start, 2, 1, 1, 1) + self.label_4 = QLabel(self.frame) self.label_4.setObjectName(u"label_4") + self.label_4.setStyleSheet(u"color: rgb(255, 255, 255);") self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) + self.label_6 = QLabel(self.frame) + self.label_6.setObjectName(u"label_6") + font = QFont() + font.setPointSize(11) + font.setBold(True) + self.label_6.setFont(font) + self.label_6.setStyleSheet(u"color: rgb(255, 255, 255);") + self.label_6.setAlignment(Qt.AlignCenter) + + self.gridLayout.addWidget(self.label_6, 1, 0, 1, 4) + self.label_3 = QLabel(self.frame) self.label_3.setObjectName(u"label_3") + self.label_3.setStyleSheet(u"color: rgb(255, 255, 255);") self.label_3.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter) - self.gridLayout.addWidget(self.label_3, 2, 2, 1, 1) + self.gridLayout.addWidget(self.label_3, 2, 3, 1, 1) - self.label_6 = QLabel(self.frame) - self.label_6.setObjectName(u"label_6") - self.label_6.setAlignment(Qt.AlignCenter) + self.toolButton_stop = QToolButton(self.frame) + self.toolButton_stop.setObjectName(u"toolButton_stop") - self.gridLayout.addWidget(self.label_6, 1, 0, 1, 3) + self.gridLayout.addWidget(self.toolButton_stop, 2, 2, 1, 1) self.verticalLayout.addWidget(self.frame) @@ -99,10 +119,12 @@ def setupUi(self, status_page): # setupUi def retranslateUi(self, status_page): - status_page.setWindowTitle(QCoreApplication.translate("status_page", u"Form", None)) + status_page.setWindowTitle(QCoreApplication.translate("status_page", u"OneDriveGUI - Process Status", None)) + self.toolButton_start.setText(QCoreApplication.translate("status_page", u"Start", None)) self.label_4.setText(QCoreApplication.translate("status_page", u"...", None)) - self.label_3.setText(QCoreApplication.translate("status_page", u"...", None)) self.label_6.setText(QCoreApplication.translate("status_page", u"Onedrive is ...", None)) + self.label_3.setText(QCoreApplication.translate("status_page", u"...", None)) + self.toolButton_stop.setText(QCoreApplication.translate("status_page", u"Stop", None)) self.pushButton.setText(QCoreApplication.translate("status_page", u"Open Folder", None)) self.pushButton_2.setText(QCoreApplication.translate("status_page", u"Sync", None)) self.pushButton_settings.setText(QCoreApplication.translate("status_page", u"Settings", None)) diff --git a/OneDriveGUI/ui/ui_profile_settings_page.py b/OneDriveGUI/ui/ui_profile_settings_page.py index 44b5ec2..c16196d 100644 --- a/OneDriveGUI/ui/ui_profile_settings_page.py +++ b/OneDriveGUI/ui/ui_profile_settings_page.py @@ -25,9 +25,10 @@ class Ui_profile_settings(object): def setupUi(self, profile_settings): if not profile_settings.objectName(): profile_settings.setObjectName(u"profile_settings") - profile_settings.resize(614, 723) + profile_settings.resize(664, 723) self.verticalLayout_2 = QVBoxLayout(profile_settings) self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setContentsMargins(-1, 0, -1, 0) self.label_profile_name = QLabel(profile_settings) self.label_profile_name.setObjectName(u"label_profile_name") font = QFont() @@ -42,7 +43,7 @@ def setupUi(self, profile_settings): self.horizontalLayout.setObjectName(u"horizontalLayout") self.tabWidget = QTabWidget(profile_settings) self.tabWidget.setObjectName(u"tabWidget") - self.tabWidget.setMinimumSize(QSize(600, 600)) + self.tabWidget.setMinimumSize(QSize(650, 600)) self.exemptions_tab_2 = QWidget() self.exemptions_tab_2.setObjectName(u"exemptions_tab_2") self.verticalLayout_5 = QVBoxLayout(self.exemptions_tab_2) @@ -435,37 +436,37 @@ def setupUi(self, profile_settings): self.checkBox_enable_logging = QCheckBox(self.groupBox_7) self.checkBox_enable_logging.setObjectName(u"checkBox_enable_logging") - self.gridLayout_8.addWidget(self.checkBox_enable_logging, 0, 0, 1, 2) - - self.pushButton_log_dir = QPushButton(self.groupBox_7) - self.pushButton_log_dir.setObjectName(u"pushButton_log_dir") - - self.gridLayout_8.addWidget(self.pushButton_log_dir, 3, 2, 1, 1) + self.gridLayout_8.addWidget(self.checkBox_enable_logging, 0, 0, 1, 1) self.label_log_dir = QLabel(self.groupBox_7) self.label_log_dir.setObjectName(u"label_log_dir") - self.gridLayout_8.addWidget(self.label_log_dir, 3, 0, 1, 1) + self.gridLayout_8.addWidget(self.label_log_dir, 1, 0, 1, 1) self.checkBox_debug_https = QCheckBox(self.groupBox_7) self.checkBox_debug_https.setObjectName(u"checkBox_debug_https") - self.gridLayout_8.addWidget(self.checkBox_debug_https, 1, 0, 1, 1) - - self.spinBox_monitor_log_frequency = QSpinBox(self.groupBox_7) - self.spinBox_monitor_log_frequency.setObjectName(u"spinBox_monitor_log_frequency") - - self.gridLayout_8.addWidget(self.spinBox_monitor_log_frequency, 2, 1, 1, 1) + self.gridLayout_8.addWidget(self.checkBox_debug_https, 4, 0, 1, 1) self.lineEdit_log_dir = QLineEdit(self.groupBox_7) self.lineEdit_log_dir.setObjectName(u"lineEdit_log_dir") - self.gridLayout_8.addWidget(self.lineEdit_log_dir, 3, 1, 1, 1) + self.gridLayout_8.addWidget(self.lineEdit_log_dir, 1, 1, 1, 1) + + self.pushButton_log_dir = QPushButton(self.groupBox_7) + self.pushButton_log_dir.setObjectName(u"pushButton_log_dir") + + self.gridLayout_8.addWidget(self.pushButton_log_dir, 1, 2, 1, 1) self.label_monitor_log_frequency = QLabel(self.groupBox_7) self.label_monitor_log_frequency.setObjectName(u"label_monitor_log_frequency") - self.gridLayout_8.addWidget(self.label_monitor_log_frequency, 2, 0, 1, 1) + self.gridLayout_8.addWidget(self.label_monitor_log_frequency, 3, 0, 1, 1) + + self.spinBox_monitor_log_frequency = QSpinBox(self.groupBox_7) + self.spinBox_monitor_log_frequency.setObjectName(u"spinBox_monitor_log_frequency") + + self.gridLayout_8.addWidget(self.spinBox_monitor_log_frequency, 3, 1, 1, 1) self.verticalLayout_9.addLayout(self.gridLayout_8) @@ -577,6 +578,18 @@ def setupUi(self, profile_settings): self.tabWidget.addTab(self.tab_5, "") self.tab_6 = QWidget() self.tab_6.setObjectName(u"tab_6") + self.horizontalLayout_2 = QHBoxLayout(self.tab_6) + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.pushButton_login = QPushButton(self.tab_6) + self.pushButton_login.setObjectName(u"pushButton_login") + + self.horizontalLayout_2.addWidget(self.pushButton_login) + + self.pushButton_logout = QPushButton(self.tab_6) + self.pushButton_logout.setObjectName(u"pushButton_logout") + + self.horizontalLayout_2.addWidget(self.pushButton_logout) + self.tabWidget.addTab(self.tab_6, "") self.horizontalLayout.addWidget(self.tabWidget) @@ -597,14 +610,14 @@ def setupUi(self, profile_settings): self.retranslateUi(profile_settings) - self.tabWidget.setCurrentIndex(2) + self.tabWidget.setCurrentIndex(5) QMetaObject.connectSlotsByName(profile_settings) # setupUi def retranslateUi(self, profile_settings): - profile_settings.setWindowTitle(QCoreApplication.translate("profile_settings", u"Form", None)) + profile_settings.setWindowTitle(QCoreApplication.translate("profile_settings", u"OneDriveGUI - Profile Settings", None)) self.label_profile_name.setText(QCoreApplication.translate("profile_settings", u"Profile name", None)) self.groupBox_8.setTitle(QCoreApplication.translate("profile_settings", u"Monitored directory", None)) self.pushButton_3.setText(QCoreApplication.translate("profile_settings", u"Browse", None)) @@ -652,9 +665,9 @@ def retranslateUi(self, profile_settings): self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("profile_settings", u"Sync Options", None)) self.groupBox_7.setTitle(QCoreApplication.translate("profile_settings", u"Logging", None)) self.checkBox_enable_logging.setText(QCoreApplication.translate("profile_settings", u"Enable Logging", None)) - self.pushButton_log_dir.setText(QCoreApplication.translate("profile_settings", u"Browse", None)) self.label_log_dir.setText(QCoreApplication.translate("profile_settings", u"Log location:", None)) self.checkBox_debug_https.setText(QCoreApplication.translate("profile_settings", u"Debug HTTPS", None)) + self.pushButton_log_dir.setText(QCoreApplication.translate("profile_settings", u"Browse", None)) self.label_monitor_log_frequency.setText(QCoreApplication.translate("profile_settings", u"Monitor log frequency", None)) self.groupBox_6.setTitle(QCoreApplication.translate("profile_settings", u"Notifications", None)) self.label_min_notify_changes.setText(QCoreApplication.translate("profile_settings", u"Minimum notify changes", None)) @@ -668,7 +681,9 @@ def retranslateUi(self, profile_settings): self.label_webhook_renewal_interval.setText(QCoreApplication.translate("profile_settings", u"Renewal interval", None)) self.checkBox_webhook_enabled.setText(QCoreApplication.translate("profile_settings", u"Enable webhook", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), QCoreApplication.translate("profile_settings", u"Webhooks", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), QCoreApplication.translate("profile_settings", u"GUI Behaviour", None)) + self.pushButton_login.setText(QCoreApplication.translate("profile_settings", u"Login", None)) + self.pushButton_logout.setText(QCoreApplication.translate("profile_settings", u"Logout", None)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), QCoreApplication.translate("profile_settings", u"Account", None)) self.pushButton_discart.setText(QCoreApplication.translate("profile_settings", u"Discard changes", None)) self.pushButton_save.setText(QCoreApplication.translate("profile_settings", u"Save", None)) # retranslateUi diff --git a/OneDriveGUI/ui/ui_settings.py b/OneDriveGUI/ui/ui_settings.py index a7ec466..eb6a1d5 100644 --- a/OneDriveGUI/ui/ui_settings.py +++ b/OneDriveGUI/ui/ui_settings.py @@ -23,17 +23,18 @@ class Ui_settings_window(object): def setupUi(self, settings_window): if not settings_window.objectName(): settings_window.setObjectName(u"settings_window") - settings_window.resize(601, 817) + settings_window.resize(272, 765) self.verticalLayout_2 = QVBoxLayout(settings_window) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") - self.label = QLabel(settings_window) - self.label.setObjectName(u"label") + self.verticalLayout.setContentsMargins(-1, 6, -1, -1) + self.label_profiles = QLabel(settings_window) + self.label_profiles.setObjectName(u"label_profiles") - self.verticalLayout.addWidget(self.label) + self.verticalLayout.addWidget(self.label_profiles) self.listWidget_profiles = QListWidget(settings_window) self.listWidget_profiles.setObjectName(u"listWidget_profiles") @@ -70,8 +71,8 @@ def setupUi(self, settings_window): # setupUi def retranslateUi(self, settings_window): - settings_window.setWindowTitle(QCoreApplication.translate("settings_window", u"Form", None)) - self.label.setText(QCoreApplication.translate("settings_window", u"Profiles:", None)) + settings_window.setWindowTitle(QCoreApplication.translate("settings_window", u"OneDriveGUI - Settings", None)) + self.label_profiles.setText(QCoreApplication.translate("settings_window", u"Profiles:", None)) self.pushButton_remove.setText(QCoreApplication.translate("settings_window", u"Remove profile", None)) self.pushButton_open_create.setText(QCoreApplication.translate("settings_window", u"Create new profile", None)) self.pushButton_open_import.setText(QCoreApplication.translate("settings_window", u"Import existing profile", None))