ConnectDialog::ConnectDialog (QWidget* parent) : QDialog (parent) { QGridLayout* layout = new QGridLayout (this); QLabel* label = new QLabel ("Host", this); layout->addWidget (label, 0, 0); _host_edit = new QLineEdit (this); layout->addWidget (_host_edit, 0, 1); label = new QLabel ("Port", this); layout->addWidget (label, 1, 0); _port_edit = new QLineEdit ("10000", this); layout->addWidget (_port_edit, 1, 1); label = new QLabel ("Name", this); layout->addWidget (label, 2, 0); _name_edit = new QLineEdit (this); layout->addWidget (_name_edit, 2, 1); QPushButton* button = new QPushButton ("&Ok", this); button->setDefault (true); connect (button, SIGNAL (pressed ()), this, SLOT (verify_input ())); layout->addWidget (button, 3, 0); button = new QPushButton ("&Cancel", this); connect (button, SIGNAL (pressed ()), this, SLOT (reject ())); layout->addWidget (button, 3, 1); }
// python function value = input(channel) static PyObject* py_input_gpio(PyObject *self, PyObject *args) { int gpio, channel; if (!PyArg_ParseTuple(args, "i", &channel)) return NULL; if (!verify_input(channel, &gpio)) return NULL; // printf("Input GPIO %d\n", gpio); if (input_gpio(gpio)) Py_RETURN_TRUE; else Py_RETURN_FALSE; }
TileSelectDialog::TileSelectDialog (QWidget* parent) : QDialog (parent) { QBoxLayout* layout = new QBoxLayout (QBoxLayout::TopToBottom, this); QRadioButton* radio_button = new QRadioButton ("Load Tile", this); radio_button->setChecked (true); layout->addWidget (radio_button); connect (radio_button, SIGNAL (toggled (bool)), this, SLOT (load_tile_toggled (bool))); _load_tile_frame = new QFrame (this); layout->addWidget (_load_tile_frame); QBoxLayout* box_layout = new QBoxLayout (QBoxLayout::LeftToRight, _load_tile_frame); _load_tile_line_edit = new QLineEdit (_load_tile_frame); box_layout->addWidget (_load_tile_line_edit); QPushButton* button = new QPushButton ("Choose", _load_tile_frame); box_layout->addWidget (button); connect (button, SIGNAL (pressed ()), this, SLOT (choose_button_pressed ())); radio_button = new QRadioButton ("Custom Tile", this); layout->addWidget (radio_button); _custom_tile_frame = new QFrame (this); _custom_tile_frame->setEnabled (false); layout->addWidget (_custom_tile_frame); connect (radio_button, SIGNAL (toggled (bool)), this, SLOT (custom_tile_toggled (bool))); QGridLayout* grid_layout = new QGridLayout (_custom_tile_frame); grid_layout->addWidget (new QLabel ("Size", _custom_tile_frame), 0, 0); _width_line_edit = new QLineEdit ("1", _custom_tile_frame); grid_layout->addWidget (_width_line_edit, 1, 0); grid_layout->addWidget (new QLabel ("x", _custom_tile_frame), 1, 1); _height_line_edit = new QLineEdit ("1", _custom_tile_frame); grid_layout->addWidget (_height_line_edit, 1, 2); grid_layout->addWidget (new QLabel ("Text", _custom_tile_frame), 2, 0); _text_line_edit = new QLineEdit (_custom_tile_frame); grid_layout->addWidget (_text_line_edit, 3, 0, 1, 3); box_layout = new QBoxLayout (QBoxLayout::RightToLeft); layout->addLayout (box_layout); button = new QPushButton ("&Ok", this); button->setDefault (true); connect (button, SIGNAL (pressed ()), this, SLOT (verify_input ())); box_layout->addWidget (button); button = new QPushButton ("&Cancel", this); connect (button, SIGNAL (pressed ()), this, SLOT (reject ())); box_layout->addWidget (button); }