Skip to content

Commit ae3abcc

Browse files
committedJun 4, 2013
DBManager: remove empty line from sql editor
1 parent 80b5a07 commit ae3abcc

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed
 

‎python/plugins/db_manager/dlg_sql_window.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def __init__(self, iface, db, parent=None):
6262
self.connect(self.btnClear, SIGNAL("clicked()"), self.clearSql)
6363
self.connect(self.buttonBox.button(QDialogButtonBox.Close), SIGNAL("clicked()"), self.close)
6464

65-
6665
self.connect(self.presetStore, SIGNAL("clicked()"), self.storePreset)
6766
self.connect(self.presetDelete, SIGNAL("clicked()"), self.deletePreset)
6867
self.connect(self.presetCombo, SIGNAL("activated(QString)"), self.loadPreset)
6968
self.connect(self.presetCombo, SIGNAL("activated(QString)"), self.presetName.setText)
69+
self.updatePresetsCombobox()
7070

7171
# hide the load query as layer if feature is not supported
7272
self._loadAsLayerAvailable = self.db.connector.hasCustomQuerySupport()
@@ -78,22 +78,18 @@ def __init__(self, iface, db, parent=None):
7878
self.connect(self.loadAsLayerGroup, SIGNAL("toggled(bool)"), self.loadAsLayerToggled)
7979
self.loadAsLayerToggled(False)
8080

81-
def showEvent(self, event):
82-
QDialog.showEvent(self, event)
83-
self.updatePresetsCombobox()
84-
8581
def updatePresetsCombobox(self):
86-
entries = QgsProject.instance().subkeyList('DBManager','savedQueries')
8782
self.presetCombo.clear()
83+
8884
names = []
85+
entries = QgsProject.instance().subkeyList('DBManager','savedQueries')
8986
for entry in entries:
9087
name = QgsProject.instance().readEntry('DBManager','savedQueries/'+entry+'/name' )[0]
9188
names.append( name )
9289

93-
names.sort()
94-
95-
for name in names:
90+
for name in sorted(names):
9691
self.presetCombo.addItem(name)
92+
self.presetCombo.setCurrentIndex(-1)
9793

9894
def storePreset(self):
9995
query = self.editSql.toPlainText()
@@ -112,6 +108,7 @@ def deletePreset(self):
112108
QgsProject.instance().removeEntry('DBManager','savedQueries/q'+str(name.__hash__()) )
113109
self.presetCombo.removeItem( self.presetCombo.findText(name) )
114110
self.presetCombo.setCurrentIndex(-1)
111+
115112
def loadPreset(self, name):
116113
query = QgsProject.instance().readEntry('DBManager','savedQueries/q'+str(name.__hash__())+'/query' )[0]
117114
name = QgsProject.instance().readEntry('DBManager','savedQueries/q'+str(name.__hash__())+'/name' )[0]

‎python/plugins/db_manager/ui/DlgSqlWindow.ui

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
</spacer>
4545
</item>
4646
<item>
47-
<widget class="QLineEdit" name="presetName"/>
47+
<widget class="QLineEdit" name="presetName">
48+
<property name="text">
49+
<string notr="true"/>
50+
</property>
51+
</widget>
4852
</item>
4953
<item>
5054
<widget class="QComboBox" name="presetCombo"/>
@@ -77,8 +81,8 @@
7781
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
7882
&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;
7983
p, li { white-space: pre-wrap; }
80-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;&quot;&gt;
81-
&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;span style=&quot; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
84+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
85+
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
8286
</property>
8387
</widget>
8488
</item>

0 commit comments

Comments
 (0)
Please sign in to comment.