1. Juan BC
  2. yatel

Commits

Juan BC  committed 9a407b7

added logic for enabled and disabled ok button

  • Participants
  • Parent commits 4165474
  • Branches default

Comments (0)

Files changed (2)

File yatel/gui/connection_setup.py

View file
  • Ignore whitespace
             self.setWindowTitle(self.tr("Create Database"))
         self.on_engineComboBox_activated(self.engineComboBox.currentText())
 
+    def on_nameLineEdit_textChanged(self, txt):
+        self.okPushButton.setEnabled(bool(txt))
+
     def on_openFileButton_pressed(self):
         """Slot executed when a ``openFileButton`` is pressed for select an
         Sqlite file.
                 lineEdit.setValidator(QtGui.QIntValidator())
             self.formLayout.insertRow(idx + 2, label, lineEdit)
             self._params[pn] = (label, lineEdit)
+        self.adjustSize()
 
     def params(self):
         """Returns a params of the conection as dictionary.

File yatel/gui/uis/ConnectionSetupDialog.ui

View file
  • Ignore whitespace
     </layout>
    </item>
    <item>
-    <widget class="QDialogButtonBox" name="buttonBox">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="cancelPushButton">
+       <property name="text">
+        <string>&amp;Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPushButton">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="text">
+        <string>&amp;OK</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>
  <resources/>
  <connections>
   <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
+   <sender>okPushButton</sender>
+   <signal>clicked()</signal>
    <receiver>ConnectionSetupDialog</receiver>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
+     <x>389</x>
+     <y>97</y>
     </hint>
     <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
+     <x>199</x>
+     <y>63</y>
     </hint>
    </hints>
   </connection>
   <connection>
-   <sender>buttonBox</sender>
-   <signal>rejected()</signal>
+   <sender>cancelPushButton</sender>
+   <signal>clicked()</signal>
    <receiver>ConnectionSetupDialog</receiver>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
+     <x>256</x>
+     <y>97</y>
     </hint>
     <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
+     <x>199</x>
+     <y>63</y>
     </hint>
    </hints>
   </connection>