Skip to content

Commit

Permalink
add syncMode (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxusPowerus authored Jan 23, 2023
1 parent 2b8c6f0 commit cc23fa2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/localappmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def createDefaultSettingsJson():
settings["serverUrl"] = defaultServerURL
settings["syncFolderPath"] = defaultSyncFolderPath
settings["notToSyncFolders"] = []
settings["syncMode"] = "Server > Client"

settings = json.dumps(settings)

Expand Down
20 changes: 20 additions & 0 deletions ui/settingsui.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def createSettingsArea(self):
self.createLocalSyncPathInput()
settingsBox.setLayout(self.settingsBoxLayout)
self.contentLayout.addWidget(settingsBox)
self.createChangeMode()

def createAboutArea(self):
aboutBox = QtWidgets.QGroupBox("About")
Expand Down Expand Up @@ -171,6 +172,24 @@ def createLocalSyncPathInput(self):

self.settingsBoxLayout.addLayout(rowLayout)

def createChangeMode(self):
rowLayout = QtWidgets.QHBoxLayout()

syncMode = QtWidgets.QLabel("Sync Mode")

self.comboBox = QtWidgets.QComboBox(self)
self.comboBox.addItem("Server > Client")
self.comboBox.addItem("Client > Server")
self.comboBox.addItem("Bidirectional")
self.comboBox.setCurrentText(LocalAppManager.getSetting("syncMode"))

rowLayout.addWidget(syncMode)
rowLayout.addWidget(self.comboBox)
self.settingsBoxLayout.addLayout(rowLayout)

def getSyncMode(self):
return self.comboBox.currentText()

def getLocalSyncPathInput(self):
return self.localSyncPathInput.text()

Expand All @@ -186,6 +205,7 @@ def clickedSave(self):

settings["syncFolderPath"] = self.getLocalSyncPathInput()
settings["notToSyncFolders"] = self.getFoldersNotToSync()
settings["syncMode"] = self.getSyncMode()

LocalAppManager.saveSettings(settings)

Expand Down

0 comments on commit cc23fa2

Please sign in to comment.