Commits

Alain Leufroy  committed 1a76487

[gui.qt] sheet: add action combobox + title

  • Participants
  • Parent commits 2dd0378

Comments (0)

Files changed (3)

File ui/gui/qt/item.py

         widget.edited.connect(self.edited.emit)
 
     def process_action(self, index):
+        """Process action from the combo box."""
         if index == 4:
             self.delete()
 
     from limma.ui.gui.qt.elements import TextBox, SubprocessBox, PathBox
     app = QtGui.QApplication(sys.argv)
     main_window = MainWindow()
-    sheet = Sheet(main_window)
+    sheet = Sheet(title='The Big sheet', parent=main_window)
     def show(mess):
         sys.stdout.write(mess)
         sys.stdout.flush()

File ui/gui/qt/sheet.py

 class Sheet(UiFromDesigner, QtGui.QWidget):
     __ui__ = 'sheet'
 
+    def __init__(self, title='input', *ags, **kws):
+        """
+        :title: label of the text box
+        :text: content text of the box
+        """
+        super(Sheet, self).__init__(*ags, **kws)
+        self._ui.label.setText(unicode(title or ''))
+        self._ui.actions.activated[int].connect(self.process_action)
+
+    def process_action(self, index):
+        """Process action from the combo box."""
+        pass
+
     def append(self, widget):
         """Adds ``widget`` to the end of this box layout."""
         self._ui.items.addWidget(widget)

File ui/gui/qt/uis/sheet.ui

    <rect>
     <x>0</x>
     <y>0</y>
-    <width>94</width>
-    <height>93</height>
+    <width>347</width>
+    <height>174</height>
    </rect>
   </property>
   <property name="sizePolicy">
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>72</width>
-        <height>71</height>
+        <width>325</width>
+        <height>152</height>
        </rect>
       </property>
       <property name="sizePolicy">
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_3">
        <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QComboBox" name="actions">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <item>
+            <property name="text">
+             <string>action1</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>action2</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>action3</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>TextLabel</string>
+           </property>
+          </widget>
+         </item>
+         <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>
+        </layout>
+       </item>
+       <item>
         <layout class="QVBoxLayout" name="items">
          <property name="sizeConstraint">
           <enum>QLayout::SetMaximumSize</enum>