finished implementation of location tool tab in properties window (used to modify settings from the GUI)

This commit is contained in:
Sebastian Wehling-Benatelli 2015-11-24 10:26:36 +01:00
parent 0a1d177d60
commit 69efd4d411

View File

@ -789,7 +789,7 @@ class PropertiesDlg(QDialog):
self.tabWidget.addTab(OutputsTab(self), "Outputs") self.tabWidget.addTab(OutputsTab(self), "Outputs")
self.tabWidget.addTab(PhasesTab(self), "Phases") self.tabWidget.addTab(PhasesTab(self), "Phases")
self.tabWidget.addTab(GraphicsTab(self), "Graphics") self.tabWidget.addTab(GraphicsTab(self), "Graphics")
self.tabWidget.addTab(LocalisationTab(self), "Tools") self.tabWidget.addTab(LocalisationTab(self), "Loc Tools")
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Apply | QDialogButtonBox.Apply |
QDialogButtonBox.Close) QDialogButtonBox.Close)
@ -934,42 +934,56 @@ class LocalisationTab(PropTab):
curroot = settings.value("%s/rootPath".format(curtool), None) curroot = settings.value("%s/rootPath".format(curtool), None)
curbin = settings.value("%s/binPath".format(curtool), None) curbin = settings.value("%s/binPath".format(curtool), None)
rootlabel = QLabel("root directory") self.rootlabel = QLabel("root directory")
binlabel = QLabel("bin directory") self.binlabel = QLabel("bin directory")
rootedit = QLineEdit('') self.rootedit = QLineEdit('')
binedit = QLineEdit('') self.binedit = QLineEdit('')
if curroot is not None:
self.rootedit.setText(curroot)
if curbin is not None:
self.binedit.setText(curbin)
rootBrowse = QPushButton('...', self) rootBrowse = QPushButton('...', self)
rootBrowse.clicked.connect(lambda: self.selectDirectory(rootedit)) rootBrowse.clicked.connect(lambda: self.selectDirectory(self.rootedit))
binBrowse = QPushButton('...', self) binBrowse = QPushButton('...', self)
binBrowse.clicked.connect(lambda: self.selectDirectory(binedit)) binBrowse.clicked.connect(lambda: self.selectDirectory(self.binedit))
if curtool is not None: self.locToolComboBox.currentIndexChanged.connect(self.updateUi)
rootlabel.setText("{0} root directory".format(curtool))
binlabel.setText("{0} bin directory".format(curtool)) self.updateUi()
if curroot is not None:
rootedit.setText(curroot)
if curbin is not None:
binedit.setText(curbin)
layout = QGridLayout() layout = QGridLayout()
layout.addWidget(loctoollabel, 0, 0) layout.addWidget(loctoollabel, 0, 0)
layout.addWidget(self.locToolComboBox, 0, 1) layout.addWidget(self.locToolComboBox, 0, 1)
layout.addWidget(rootlabel, 1, 0) layout.addWidget(self.rootlabel, 1, 0)
layout.addWidget(rootedit, 1, 1) layout.addWidget(self.rootedit, 1, 1)
layout.addWidget(rootBrowse, 1, 2) layout.addWidget(rootBrowse, 1, 2)
layout.addWidget(binlabel, 2, 0) layout.addWidget(self.binlabel, 2, 0)
layout.addWidget(binedit, 2, 1) layout.addWidget(self.binedit, 2, 1)
layout.addWidget(binBrowse, 2, 2) layout.addWidget(binBrowse, 2, 2)
self.setLayout(layout) self.setLayout(layout)
def updateUi(self):
curtool = self.locToolComboBox.currentText()
if curtool is not None:
self.rootlabel.setText("{0} root directory".format(curtool))
self.binlabel.setText("{0} bin directory".format(curtool))
def selectDirectory(self, edit): def selectDirectory(self, edit):
selected_directory = QFileDialog.getExistingDirectory() selected_directory = QFileDialog.getExistingDirectory()
edit.setText(selected_directory) edit.setText(selected_directory)
def getValues(self):
loctool = self.locToolComboBox.currentText()
values = {"%s/rootPath".format(loctool): self.rootedit.text(),
"%s/binPath".format(loctool): self.binedit.text(),
"loc/tool": loctool}
return values
class NewEventDlg(QDialog): class NewEventDlg(QDialog):