Example #1
0
    def __init__(self, parent=None, name=None, fl=0):
        QtImport.QDialog.__init__(self, parent, QtImport.Qt.WindowFlags(fl))

        if name is not None:
            self.setObjectName(name)

        # Internal variables --------------------------------------------------
        # AsyncResult to return values
        self._async_result = None

        # Layout
        QtImport.QVBoxLayout(self)
        main_layout = self.layout()
        main_layout.setSpacing(10)
        main_layout.setMargin(6)
        self.setSizePolicy(QtImport.QSizePolicy.Expanding,
                           QtImport.QSizePolicy.Expanding)

        self.setWindowTitle("GPhL Workflow parameters")

        # Info box
        self.info_gbox = QtImport.QGroupBox("Info", self)
        QtImport.QVBoxLayout(self.info_gbox)
        main_layout.addWidget(self.info_gbox)
        self.info_text = QtImport.QTextEdit(self.info_gbox)
        self.info_text.setFont(QtImport.QFont("Courier"))
        self.info_text.setReadOnly(True)
        self.info_gbox.layout().addWidget(self.info_text)

        # Special parameter box
        self.cplx_gbox = QtImport.QGroupBox("Indexing solution", self)
        QtImport.QVBoxLayout(self.cplx_gbox)
        main_layout.addWidget(self.cplx_gbox)
        self.cplx_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                     QtImport.QSizePolicy.Expanding)
        self.cplx_widget = None

        # Parameter box
        self.parameter_gbox = QtImport.QGroupBox("Parameters", self)
        main_layout.addWidget(self.parameter_gbox)
        self.parameter_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding,
                                          QtImport.QSizePolicy.Expanding)
        self.params_widget = None

        # Button bar
        button_layout = QtImport.QHBoxLayout(None)
        hspacer = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding,
                                       QtImport.QSizePolicy.Minimum)
        button_layout.addItem(hspacer)
        self.continue_button = QtImport.QPushButton("Continue", self)
        button_layout.addWidget(self.continue_button)
        self.cancel_button = QtImport.QPushButton("Abort", self)
        button_layout.addWidget(self.cancel_button)
        main_layout.addLayout(button_layout)

        self.continue_button.clicked.connect(self.continue_button_click)
        self.cancel_button.clicked.connect(self.cancel_button_click)

        self.resize(
            QtImport.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
Example #2
0
 def populateColumn(self, colNum, values, colours=None):
     """Fill values into column, extending if necessary"""
     if len(values) > self.rowCount():
         self.setRowCount(len(values))
     for rowNum, text in enumerate(values):
         wdg = QtImport.QLineEdit(self)
         wdg.setFont(QtImport.QFont("Courier"))
         wdg.setReadOnly(True)
         wdg.setText(ConvertUtils.text_type(text))
         if colours:
             colour = colours[rowNum]
             if colour:
                 Colors.set_widget_color(wdg, getattr(Colors, colour),
                                         QtImport.QPalette.Base)
                 # wdg.setBackground(getattr(QtImport.QColor, colour))
         self.setCellWidget(rowNum, colNum, wdg)
Example #3
0
    def __init__(self, parent=None, name="selection_table", header=None):
        QtImport.QTableWidget.__init__(self, parent)
        if not header:
            raise ValueError("DisplayTable must be initialised with header")

        self.setObjectName(name)
        self.setFrameShape(QtImport.QFrame.StyledPanel)
        self.setFrameShadow(QtImport.QFrame.Sunken)
        self.setContentsMargins(0, 3, 0, 3)
        self.setColumnCount(len(header))
        self.setSelectionMode(QtImport.QTableWidget.SingleSelection)
        self.setHorizontalHeaderLabels(header)
        self.setSizePolicy(QtImport.QSizePolicy.Expanding,
                           QtImport.QSizePolicy.Expanding)
        self.setFont(QtImport.QFont("Courier"))

        hdr = self.horizontalHeader()
        hdr.setResizeMode(0, QtImport.QHeaderView.Stretch)
        for ii in range(1, len(header)):
            hdr.setResizeMode(ii, QtImport.QHeaderView.ResizeToContents)