Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[DBManager] Allow non-spatial layers
  • Loading branch information
Hugo Mercier committed May 4, 2015
1 parent 72eb1aa commit 00618fc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
8 changes: 6 additions & 2 deletions python/plugins/db_manager/dlg_sql_window.py
Expand Up @@ -179,9 +179,13 @@ def executeSql(self):

def loadSqlLayer(self):
uniqueFieldName = self.uniqueCombo.currentText()
geomFieldName = self.geomCombo.currentText()
hasGeomCol = self.hasGeometryCol.checkState() == Qt.Checked
if hasGeomCol:
geomFieldName = self.geomCombo.currentText()
else:
geomFieldName = None

if geomFieldName == "" or uniqueFieldName == "":
if (hasGeomCol and geomFieldName == "") or uniqueFieldName == "":
QMessageBox.warning(self, self.tr("DB Manager"), self.tr(
"You must fill the required fields: \ngeometry column - column with unique integer values"))
return
Expand Down
25 changes: 22 additions & 3 deletions python/plugins/db_manager/ui/DlgSqlWindow.ui
Expand Up @@ -205,12 +205,15 @@ integer values</string>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QCheckBox" name="hasGeometryCol">
<property name="text">
<string>Geometry column</string>
</property>
<property name="indent">
<number>40</number>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
Expand Down Expand Up @@ -384,5 +387,21 @@ columns</string>
</hint>
</hints>
</connection>
<connection>
<sender>hasGeometryCol</sender>
<signal>toggled(bool)</signal>
<receiver>geomCombo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>379</x>
<y>385</y>
</hint>
<hint type="destinationlabel">
<x>525</x>
<y>385</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit 00618fc

Please sign in to comment.