Skip to content

Commit e7c4d80

Browse files
committedDec 26, 2018
Delete comment with NULL + Remove useless comment
1 parent 09a6b33 commit e7c4d80

File tree

4 files changed

+49
-44
lines changed

4 files changed

+49
-44
lines changed
 

‎python/plugins/db_manager/dlg_import_vector.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from qgis.gui import QgsMessageViewer
4040
from qgis.utils import OverrideCursor
4141

42-
import psycopg2
4342
from .ui.ui_DlgImportVector import Ui_DbManagerDlgImportVector as Ui_Dialog
4443

4544

@@ -52,7 +51,6 @@ def __init__(self, inLayer, outDb, outUri, parent=None):
5251
self.db = outDb
5352
self.outUri = outUri
5453
self.setupUi(self)
55-
print(self.db)
5654

5755
self.default_pk = "id"
5856
self.default_geom = "geom"
@@ -82,9 +80,7 @@ def setupWorkingMode(self, mode):
8280

8381
if mode == self.ASK_FOR_INPUT_MODE:
8482
self.btnChooseInputFile.clicked.connect(self.chooseInputFile)
85-
# self.cboInputLayer.lineEdit().editingFinished.connect(self.updateInputLayer)
86-
self.cboInputLayer.editTextChanged.connect(self.inputPathChanged)
87-
# self.cboInputLayer.currentIndexChanged.connect(self.updateInputLayer)
83+
self.cboInputLayer.currentTextChanged.connect(self.updateInputLayer)
8884
self.btnUpdateInputLayer.clicked.connect(self.updateInputLayer)
8985

9086
self.editPrimaryKey.setText(self.default_pk)
@@ -162,13 +158,6 @@ def chooseInputFile(self):
162158

163159
self.cboInputLayer.setEditText(filename)
164160

165-
def inputPathChanged(self, path):
166-
if self.cboInputLayer.currentIndex() < 0:
167-
return
168-
self.cboInputLayer.blockSignals(True)
169-
self.cboInputLayer.setCurrentIndex(-1)
170-
self.cboInputLayer.setEditText(path)
171-
self.cboInputLayer.blockSignals(False)
172161

173162
def reloadInputLayer(self):
174163
""" create the input layer and update available options """
@@ -383,7 +372,7 @@ def accept(self):
383372
#Add comment on table
384373
if self.chkCom.isEnabled() and self.chkCom.isChecked():
385374
#Using connector executing COMMENT ON TABLE query (with editCome.text() value)
386-
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}E\' '.format(schema, table ,self.editCom.text()))
375+
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}E\''.format(schema, table ,self.editCom.text()))
387376

388377
self.db.connection().reconnect()
389378
self.db.refresh()

‎python/plugins/db_manager/dlg_table_properties.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def createComment(self):
336336
#Function that add a comment to the selected table
337337
try:
338338
#Using the db connector, executing de SQL query Comment on table
339-
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\' '.format(self.table.schema().name, self.table.name ,self.viewComment.text()))
339+
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'{2}\';'.format(self.table.schema().name, self.table.name ,self.viewComment.text()))
340340
except DbError as e:
341341
DlgDbError.showError(e, self)
342342
return
@@ -348,8 +348,8 @@ def createComment(self):
348348
def deleteComment(self):
349349
#Function that drop the comment to the selected table
350350
try:
351-
#Using the db connector, executing de SQL query Comment on table. Comment is void ''
352-
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS E\'\' '.format(self.table.schema().name, self.table.name))
351+
#Using the db connector, executing de SQL query Comment on table using the NULL definition
352+
self.db.connector._execute(None, 'COMMENT ON TABLE "{0}"."{1}" IS NULL;'.format(self.table.schema().name, self.table.name))
353353
except DbError as e:
354354
DlgDbError.showError(e, self)
355355
return

‎python/plugins/db_manager/ui/DlgImportVector.ui

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
</widget>
263263
</item>
264264
<item row="10" column="1">
265-
<widget class="QLineEdit" name="editCom">
265+
<widget class="QLineEdit" name="editComment">
266266
<property name="enabled">
267267
<bool>false</bool>
268268
</property>
@@ -324,8 +324,8 @@
324324
<slot>reject()</slot>
325325
<hints>
326326
<hint type="sourcelabel">
327-
<x>334</x>
328-
<y>486</y>
327+
<x>343</x>
328+
<y>617</y>
329329
</hint>
330330
<hint type="destinationlabel">
331331
<x>286</x>
@@ -340,12 +340,12 @@
340340
<slot>setEnabled(bool)</slot>
341341
<hints>
342342
<hint type="sourcelabel">
343-
<x>129</x>
344-
<y>239</y>
343+
<x>155</x>
344+
<y>268</y>
345345
</hint>
346346
<hint type="destinationlabel">
347-
<x>460</x>
348-
<y>239</y>
347+
<x>463</x>
348+
<y>272</y>
349349
</hint>
350350
</hints>
351351
</connection>
@@ -356,12 +356,12 @@
356356
<slot>setEnabled(bool)</slot>
357357
<hints>
358358
<hint type="sourcelabel">
359-
<x>141</x>
360-
<y>265</y>
359+
<x>167</x>
360+
<y>306</y>
361361
</hint>
362362
<hint type="destinationlabel">
363-
<x>442</x>
364-
<y>265</y>
363+
<x>463</x>
364+
<y>310</y>
365365
</hint>
366366
</hints>
367367
</connection>
@@ -372,12 +372,12 @@
372372
<slot>setEnabled(bool)</slot>
373373
<hints>
374374
<hint type="sourcelabel">
375-
<x>119</x>
376-
<y>343</y>
375+
<x>145</x>
376+
<y>404</y>
377377
</hint>
378378
<hint type="destinationlabel">
379-
<x>455</x>
380-
<y>343</y>
379+
<x>463</x>
380+
<y>406</y>
381381
</hint>
382382
</hints>
383383
</connection>
@@ -388,8 +388,8 @@
388388
<slot>accept()</slot>
389389
<hints>
390390
<hint type="sourcelabel">
391-
<x>461</x>
392-
<y>486</y>
391+
<x>470</x>
392+
<y>617</y>
393393
</hint>
394394
<hint type="destinationlabel">
395395
<x>508</x>
@@ -404,12 +404,12 @@
404404
<slot>setEnabled(bool)</slot>
405405
<hints>
406406
<hint type="sourcelabel">
407-
<x>134</x>
408-
<y>281</y>
407+
<x>160</x>
408+
<y>341</y>
409409
</hint>
410410
<hint type="destinationlabel">
411-
<x>357</x>
412-
<y>281</y>
411+
<x>463</x>
412+
<y>341</y>
413413
</hint>
414414
</hints>
415415
</connection>
@@ -420,12 +420,28 @@
420420
<slot>setEnabled(bool)</slot>
421421
<hints>
422422
<hint type="sourcelabel">
423-
<x>134</x>
424-
<y>307</y>
423+
<x>160</x>
424+
<y>372</y>
425425
</hint>
426426
<hint type="destinationlabel">
427-
<x>357</x>
428-
<y>307</y>
427+
<x>463</x>
428+
<y>372</y>
429+
</hint>
430+
</hints>
431+
</connection>
432+
<connection>
433+
<sender>chkCom</sender>
434+
<signal>toggled(bool)</signal>
435+
<receiver>editComment</receiver>
436+
<slot>setEnabled(bool)</slot>
437+
<hints>
438+
<hint type="sourcelabel">
439+
<x>64</x>
440+
<y>549</y>
441+
</hint>
442+
<hint type="destinationlabel">
443+
<x>215</x>
444+
<y>552</y>
429445
</hint>
430446
</hints>
431447
</connection>

‎python/plugins/db_manager/ui/DlgTableProperties.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<item>
1818
<widget class="QTabWidget" name="tabs">
1919
<property name="currentIndex">
20-
<number>3</number>
20+
<number>0</number>
2121
</property>
2222
<widget class="QWidget" name="tabColumns">
2323
<attribute name="title">
@@ -219,7 +219,7 @@
219219
<item>
220220
<widget class="QPushButton" name="btnAddComment">
221221
<property name="text">
222-
<string>Add index</string>
222+
<string>Add comment</string>
223223
</property>
224224
</widget>
225225
</item>
@@ -239,7 +239,7 @@
239239
<item>
240240
<widget class="QPushButton" name="btnDeleteComment">
241241
<property name="text">
242-
<string>Delete index</string>
242+
<string>Delete comment</string>
243243
</property>
244244
</widget>
245245
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.