From 59e9f4eecd5eacf9547d77b94ff466d78dac8de9 Mon Sep 17 00:00:00 2001 From: "Nathan.Woodrow" Date: Tue, 19 May 2015 22:17:58 +1000 Subject: [PATCH] Add ui option for setting QGIS install path --- src/configmanager/ui/projectwidget.py | 21 +++- src/configmanager/ui/ui_projectwidget.ui | 146 +++++++++++++---------- src/roam.config | 3 +- 3 files changed, 105 insertions(+), 65 deletions(-) diff --git a/src/configmanager/ui/projectwidget.py b/src/configmanager/ui/projectwidget.py index 5abfdcd14..0ac962774 100644 --- a/src/configmanager/ui/projectwidget.py +++ b/src/configmanager/ui/projectwidget.py @@ -9,7 +9,7 @@ from PyQt4.QtCore import Qt, QDir, QFileInfo, pyqtSignal, QModelIndex, QFileSystemWatcher, QUrl from PyQt4.QtGui import (QWidget, QStandardItemModel, QStandardItem, QIcon, QMessageBox, QPixmap, QDesktopServices, QMenu, - QToolButton) + QToolButton, QFileDialog) from qgis.core import QgsProject, QgsMapLayerRegistry, QgsPalLabeling, QGis from qgis.gui import QgsMapCanvas, QgsExpressionBuilderDialog, QgsMessageBar @@ -86,6 +86,25 @@ def __init__(self, parent=None): self.currentnode = None self.form = None + qgislocation = r'C:\OSGeo4W\bin\qgis.bat' + qgislocation = roam.config.settings.setdefault('configmanager', {}) \ + .setdefault('qgislocation', qgislocation) + + self.qgispathEdit.setText(qgislocation) + self.qgispathEdit.textChanged.connect(self.save_qgis_path) + self.filePickerButton.pressed.connect(self.set_qgis_path) + + def set_qgis_path(self): + path = QFileDialog.getOpenFileName(self, "Select QGIS install file", filter="(*.bat)") + if not path: + return + self.qgispathEdit.setText(path) + self.save_qgis_path(path) + + def save_qgis_path(self, path): + roam.config.settings['configmanager'] = {'qgislocation': path} + roam.config.save() + def setpage(self, page, node): self.currentnode = node diff --git a/src/configmanager/ui/ui_projectwidget.ui b/src/configmanager/ui/ui_projectwidget.ui index bfc47c37b..e8c3bebf0 100644 --- a/src/configmanager/ui/ui_projectwidget.ui +++ b/src/configmanager/ui/ui_projectwidget.ui @@ -6,7 +6,7 @@ 0 0 - 793 + 821 667 @@ -99,7 +99,7 @@ QLabel[warning=true] - 6 + 4 @@ -162,20 +162,7 @@ QLabel[warning=true] - - - - IntraMaps Roam Config Manager allows the creation and managment of Roam projects and forms. - - - true - - - true - - - - + About @@ -254,6 +241,25 @@ QLabel[warning=true] + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Segoe UI'; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam"><span style=" text-decoration: underline; color:#0000ff;">Project Home Page</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam/issues?state=open"><span style=" text-decoration: underline; color:#0000ff;">Issue Tracker</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam/wiki"><span style=" text-decoration: underline; color:#0000ff;">Project Wiki</span></a></p></body></html> + + + true + + + Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse + + + @@ -285,25 +291,6 @@ QLabel[warning=true] - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Segoe UI'; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam"><span style=" text-decoration: underline; color:#0000ff;">Project Home Page</span></a></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam/issues?state=open"><span style=" text-decoration: underline; color:#0000ff;">Issue Tracker</span></a></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/DMS-Aus/Roam/wiki"><span style=" text-decoration: underline; color:#0000ff;">Project Wiki</span></a></p></body></html> - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse - - - @@ -325,34 +312,47 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical + + + + Select the Project tree item on the left to create a new project - - - 20 - 40 - + + true - + + true + + - - + + Qt::Horizontal - 40 + 350 20 - - + + + + IntraMaps Roam Config Manager allows the creation and managment of Roam projects and forms. + + + true + + + true + + + + + Qt::Vertical @@ -364,18 +364,39 @@ p, li { white-space: pre-wrap; } - - - - Select the Project tree item on the left to create a new project - - - true - - - true - - + + + + + + QGIS Install path + + + + + + + + + + ... + + + + :/icons/folder:/icons/folder + + + + 24 + 24 + + + + true + + + + @@ -737,7 +758,6 @@ p, li { white-space: pre-wrap; } - diff --git a/src/roam.config b/src/roam.config index 9940dff6a..76ccdfc13 100644 --- a/src/roam.config +++ b/src/roam.config @@ -1,5 +1,6 @@ +camera: 0 configmanager: - qgislocation: C:\OSGeo4W\bin\qgis.bat + qgislocation: !!python/unicode 'C:/OSGeo4W/bin/qgis.bat' fullscreen: false gps: tracking: