Skip to content

Commit

Permalink
Add ui option for setting QGIS install path
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed May 19, 2015
1 parent 1c64fcf commit 59e9f4e
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 65 deletions.
21 changes: 20 additions & 1 deletion src/configmanager/ui/projectwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
146 changes: 83 additions & 63 deletions src/configmanager/ui/ui_projectwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>793</width>
<width>821</width>
<height>667</height>
</rect>
</property>
Expand Down Expand Up @@ -99,7 +99,7 @@ QLabel[warning=true]
</sizepolicy>
</property>
<property name="currentIndex">
<number>6</number>
<number>4</number>
</property>
<widget class="ProjectInfoWidget" name="project_info_page">
<layout class="QGridLayout" name="gridLayout_11"/>
Expand Down Expand Up @@ -162,20 +162,7 @@ QLabel[warning=true]
</widget>
<widget class="QWidget" name="roam_page">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="label_42">
<property name="text">
<string>IntraMaps Roam Config Manager allows the creation and managment of Roam projects and forms.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="isheader" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<item row="4" column="1">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>About</string>
Expand Down Expand Up @@ -254,6 +241,25 @@ QLabel[warning=true]
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_41">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Project Home Page&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam/issues?state=open&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Issue Tracker&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam/wiki&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Project Wiki&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_20">
<property name="sizePolicy">
Expand Down Expand Up @@ -285,25 +291,6 @@ QLabel[warning=true]
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_41">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Project Home Page&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam/issues?state=open&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Issue Tracker&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/DMS-Aus/Roam/wiki&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Project Wiki&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
Expand All @@ -325,34 +312,47 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_43">
<property name="text">
<string>Select the Project tree item on the left to create a new project</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="wordWrap">
<bool>true</bool>
</property>
</spacer>
<property name="isheader" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_5">
<item row="4" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>350</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<spacer name="verticalSpacer_5">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_42">
<property name="text">
<string>IntraMaps Roam Config Manager allows the creation and managment of Roam projects and forms.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="isheader" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
Expand All @@ -364,18 +364,39 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="label_43">
<property name="text">
<string>Select the Project tree item on the left to create a new project</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="isheader" stdset="0">
<bool>true</bool>
</property>
</widget>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>QGIS Install path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="qgispathEdit"/>
</item>
<item>
<widget class="QToolButton" name="filePickerButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../roam/resources.qrc">
<normaloff>:/icons/folder</normaloff>:/icons/folder</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -737,7 +758,6 @@ p, li { white-space: pre-wrap; }
<include location="../../roam/resources.qrc"/>
<include location="../../roam/resources.qrc"/>
<include location="../../roam/resources.qrc"/>
<include location="C:/Users/Nathan/roam/resources.qrc"/>
</resources>
<connections>
<connection>
Expand Down
3 changes: 2 additions & 1 deletion src/roam.config
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 59e9f4e

Please sign in to comment.