You've already forked OneDriveGUI
mirror of
https://github.com/bpozdena/OneDriveGUI.git
synced 2026-10-24 04:59:17 +03:00
@@ -54,6 +54,7 @@ from ui.ui_create_new_profile import Ui_create_new_profile
|
||||
|
||||
|
||||
PROFILES_FILE = os.path.expanduser("~/.config/onedrive-gui/profiles")
|
||||
GUI_SETTINGS_FILE = os.path.expanduser("~/.config/onedrive-gui/gui_settings")
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# Logging
|
||||
@@ -1368,7 +1369,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
#
|
||||
# Menu
|
||||
self.menubar.hide()
|
||||
# self.menubar.hide()
|
||||
self.actionStart_Minimized.triggered.connect(self.set_check_box_state)
|
||||
if gui_settings["SETTINGS"]["start_minimized"] == "True":
|
||||
self.actionStart_Minimized.setChecked(True)
|
||||
|
||||
self.actionQuit.triggered.connect(sys.exit)
|
||||
|
||||
# Update OneDrive Status
|
||||
self.actionRefresh_Service_Status.triggered.connect(lambda: self.onedrive_process_status())
|
||||
|
||||
@@ -1443,6 +1450,20 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.auto_sync.timeout.connect(self.autostart_monitor)
|
||||
self.auto_sync.start(1000)
|
||||
|
||||
def set_check_box_state(self, state):
|
||||
_property = self.sender().objectName()
|
||||
logging.info(f"[GUI] {_property} changed to '{state}'")
|
||||
|
||||
if state == True:
|
||||
logging.info(f"is checked")
|
||||
gui_settings["SETTINGS"]["start_minimized"] = "True"
|
||||
else:
|
||||
logging.info(f"is unchecked")
|
||||
gui_settings["SETTINGS"]["start_minimized"] = "False"
|
||||
|
||||
with open(GUI_SETTINGS_FILE, "w") as f:
|
||||
gui_settings.write(f)
|
||||
|
||||
def closeEvent(self, event):
|
||||
event.ignore()
|
||||
self.hide()
|
||||
@@ -1707,6 +1728,22 @@ def read_config(config_file):
|
||||
return config
|
||||
|
||||
|
||||
def read_gui_settings():
|
||||
default_gui_settings = {
|
||||
"SETTINGS": {
|
||||
"start_minimized": "False",
|
||||
}
|
||||
}
|
||||
|
||||
gui_settings = ConfigParser()
|
||||
gui_settings.read_dict(default_gui_settings) # Read default settings and use them when config file does not exist.
|
||||
gui_settings.read(GUI_SETTINGS_FILE) # Read user settings from file and overwrite defaults.
|
||||
|
||||
logging.debug(f"GUI SETTINGS: {gui_settings._sections}")
|
||||
|
||||
return gui_settings
|
||||
|
||||
|
||||
def create_global_config():
|
||||
"""
|
||||
Creates dict which is used as running global config.
|
||||
@@ -1822,6 +1859,7 @@ def save_global_config():
|
||||
|
||||
if __name__ == "__main__":
|
||||
global_config = create_global_config()
|
||||
gui_settings = read_gui_settings()
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("OneDriveGUI")
|
||||
@@ -1831,5 +1869,9 @@ if __name__ == "__main__":
|
||||
settings_window = SettingsWindow()
|
||||
settings_window.hide()
|
||||
|
||||
main_window.show()
|
||||
if gui_settings["SETTINGS"]["start_minimized"] == "True":
|
||||
main_window.hide()
|
||||
else:
|
||||
main_window.show()
|
||||
|
||||
app.exec()
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@@ -103,7 +102,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>420</width>
|
||||
<height>30</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuAdvanced">
|
||||
@@ -111,10 +110,16 @@ color: rgb(255, 255, 255);</string>
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuDebug">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuService">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Service</string>
|
||||
</property>
|
||||
@@ -141,14 +146,10 @@ color: rgb(255, 255, 255);</string>
|
||||
<addaction name="menuMonitor"/>
|
||||
<addaction name="menuStatus"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuaccount2">
|
||||
<property name="title">
|
||||
<string>account2</string>
|
||||
</property>
|
||||
<addaction name="actionstart"/>
|
||||
</widget>
|
||||
<addaction name="menuDebug"/>
|
||||
<addaction name="menuaccount2"/>
|
||||
<addaction name="actionStart_Minimized"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<addaction name="menuAdvanced"/>
|
||||
</widget>
|
||||
@@ -207,6 +208,19 @@ color: rgb(255, 255, 255);</string>
|
||||
<string>start</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStart_Minimized">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Minimized</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'mainwindow.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.2.2
|
||||
## Created by: Qt User Interface Compiler version 6.2.3
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
@@ -52,6 +52,11 @@ class Ui_MainWindow(object):
|
||||
self.actionTest_Service.setObjectName(u"actionTest_Service")
|
||||
self.actionstart = QAction(MainWindow)
|
||||
self.actionstart.setObjectName(u"actionstart")
|
||||
self.actionStart_Minimized = QAction(MainWindow)
|
||||
self.actionStart_Minimized.setObjectName(u"actionStart_Minimized")
|
||||
self.actionStart_Minimized.setCheckable(True)
|
||||
self.actionQuit = QAction(MainWindow)
|
||||
self.actionQuit.setObjectName(u"actionQuit")
|
||||
self.centralwidget = QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(u"centralwidget")
|
||||
self.verticalLayout = QVBoxLayout(self.centralwidget)
|
||||
@@ -93,24 +98,26 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QMenuBar(MainWindow)
|
||||
self.menubar.setObjectName(u"menubar")
|
||||
self.menubar.setGeometry(QRect(0, 0, 420, 30))
|
||||
self.menubar.setGeometry(QRect(0, 0, 420, 22))
|
||||
self.menuAdvanced = QMenu(self.menubar)
|
||||
self.menuAdvanced.setObjectName(u"menuAdvanced")
|
||||
self.menuDebug = QMenu(self.menuAdvanced)
|
||||
self.menuDebug.setObjectName(u"menuDebug")
|
||||
self.menuDebug.setEnabled(False)
|
||||
self.menuService = QMenu(self.menuDebug)
|
||||
self.menuService.setObjectName(u"menuService")
|
||||
self.menuService.setEnabled(False)
|
||||
self.menuMonitor = QMenu(self.menuDebug)
|
||||
self.menuMonitor.setObjectName(u"menuMonitor")
|
||||
self.menuStatus = QMenu(self.menuDebug)
|
||||
self.menuStatus.setObjectName(u"menuStatus")
|
||||
self.menuaccount2 = QMenu(self.menuAdvanced)
|
||||
self.menuaccount2.setObjectName(u"menuaccount2")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
|
||||
self.menubar.addAction(self.menuAdvanced.menuAction())
|
||||
self.menuAdvanced.addAction(self.menuDebug.menuAction())
|
||||
self.menuAdvanced.addAction(self.menuaccount2.menuAction())
|
||||
self.menuAdvanced.addAction(self.actionStart_Minimized)
|
||||
self.menuAdvanced.addSeparator()
|
||||
self.menuAdvanced.addAction(self.actionQuit)
|
||||
self.menuDebug.addAction(self.menuService.menuAction())
|
||||
self.menuDebug.addAction(self.menuMonitor.menuAction())
|
||||
self.menuDebug.addAction(self.menuStatus.menuAction())
|
||||
@@ -122,7 +129,6 @@ class Ui_MainWindow(object):
|
||||
self.menuMonitor.addAction(self.actionForce_Resync)
|
||||
self.menuStatus.addAction(self.actionRefresh_Service_Status)
|
||||
self.menuStatus.addAction(self.actionObtain_Sync_Status)
|
||||
self.menuaccount2.addAction(self.actionstart)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
|
||||
@@ -142,12 +148,13 @@ class Ui_MainWindow(object):
|
||||
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.actionStart_Minimized.setText(QCoreApplication.translate("MainWindow", u"Start Minimized", None))
|
||||
self.actionQuit.setText(QCoreApplication.translate("MainWindow", u"Quit", 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))
|
||||
self.menuMonitor.setTitle(QCoreApplication.translate("MainWindow", u"Monitor", None))
|
||||
self.menuStatus.setTitle(QCoreApplication.translate("MainWindow", u"Status", None))
|
||||
self.menuaccount2.setTitle(QCoreApplication.translate("MainWindow", u"account2", None))
|
||||
# retranslateUi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user