Ejemplo n.º 1
0
def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
    """
    Create form dialog and return result
    (if Cancel button is pressed, return None)

    data: datalist, datagroup
    title: string
    comment: string
    icon: QIcon instance
    parent: parent QWidget
    apply: apply callback (function)

    datalist: list/tuple of (field_name, field_value)
    datagroup: list/tuple of (datalist *or* datagroup, title, comment)

    -> one field for each member of a datalist
    -> one tab for each member of a top-level datagroup
    -> one page (of a multipage widget, each page can be selected with a combo
       box) for each member of a datagroup inside a datagroup

    Supported types for field_value:
      - int, float, str, unicode, bool
      - colors: in Qt-compatible text form, i.e. in hex format or name (red,...)
                (automatically detected from a string)
      - list/tuple:
          * the first element will be the selected index (or value)
          * the other elements can be couples (key, value) or only values
    """

    # Create a QApplication instance if no instance currently exists
    # (e.g., if the module is used directly from the interpreter)
    if QtGui.QApplication.startingUp():
        _app = QtGui.QApplication([])
    dialog = FormDialog(data, title, comment, icon, parent, apply)
    if dialog.exec_():
        return dialog.get()
Ejemplo n.º 2
0





            i+=1
        self.setLayout(toplayout)
        self.show()

    @QtCore.Slot(float)
    def sl_update_position(self, position):
        pass

    @QtCore.Slot()
    def gui_stop(self, motorID):
        print motorID
        stop(motorID)

    @QtCore.Slot(float)
    def new_position(self, pos, motor):
        AAA
        print 'start motor move'
        move(motor, pos)


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = Motor()
    window.show()
    sys.exit(app.exec_())