def setupUi(self): """create all Ui elements but do not fill them""" self.buttonBox = KDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) # Ubuntu 11.10 unity is a bit strange - without this, it sets focus on # the cancel button (which it shows on the left). I found no obvious # way to use setDefault and setAutoDefault for fixing this. self.buttonBox.button(QDialogButtonBox.Ok).setFocus(True) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) vbox = QVBoxLayout(self) self.grid = QFormLayout() self.cbServer = QComboBox() self.cbServer.setEditable(True) self.grid.addRow(i18n('Game server:'), self.cbServer) self.cbUser = QComboBox() self.cbUser.setEditable(True) self.grid.addRow(i18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset) vbox.addLayout(self.grid) vbox.addWidget(self.buttonBox) pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) self.cbUser.setSizePolicy(pol) self.__port = None
def setupUILastTileMeld(self, pGrid): """setup UI elements for last tile and last meld""" self.lblLastTile = QLabel(i18n('&Last Tile:')) self.cbLastTile = QComboBox() self.cbLastTile.setMinimumContentsLength(1) vpol = QSizePolicy() vpol.setHorizontalPolicy(QSizePolicy.Fixed) self.cbLastTile.setSizePolicy(vpol) self.cbLastTile.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLengthWithIcon) self.lblLastTile.setBuddy(self.cbLastTile) self.lblLastMeld = QLabel(i18n('L&ast Meld:')) self.prevLastTile = None self.cbLastMeld = QComboBox() self.cbLastMeld.setMinimumContentsLength(1) self.cbLastMeld.setSizePolicy(vpol) self.cbLastMeld.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLengthWithIcon) self.lblLastMeld.setBuddy(self.cbLastMeld) self.comboTilePairs = set() pGrid.setRowStretch(6, 5) pGrid.addWidget(self.lblLastTile, 7, 0, 1, 2) pGrid.addWidget(self.cbLastTile, 7, 2, 1, 1) pGrid.addWidget(self.lblLastMeld, 8, 0, 1, 2) pGrid.addWidget(self.cbLastMeld, 8, 2, 1, 2)
def __init__(self, phl_obj=None, parent=None): super(IndexSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent # indexing_method_check = QCheckBox("indexing.method") hbox_method = QHBoxLayout() label_method_62 = QLabel("Indexing Method") hbox_method.addWidget(label_method_62) box_method_62 = QComboBox() box_method_62.tmp_lst = [] box_method_62.local_path = "indexing.method" box_method_62.tmp_lst.append("fft3d") box_method_62.tmp_lst.append("fft1d") box_method_62.tmp_lst.append("real_space_grid_search") box_method_62.tmp_lst.append("low_res_spot_match") for lst_itm in box_method_62.tmp_lst: box_method_62.addItem(lst_itm) box_method_62.currentIndexChanged.connect(self.combobox_changed) hbox_method.addWidget(box_method_62) localLayout = QVBoxLayout() localLayout.addLayout(hbox_method) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self): SelectRuleset.__init__(self) Players.load() decorateWindow(self, i18n('Select four players')) self.names = None self.nameWidgets = [] for idx, wind in enumerate(Wind.all4): cbName = QComboBox() cbName.manualSelect = False # increase width, we want to see the full window title cbName.setMinimumWidth(350) # is this good for all platforms? cbName.addItems(list(Players.humanNames.values())) self.grid.addWidget(cbName, idx + 1, 1) self.nameWidgets.append(cbName) self.grid.addWidget(WindLabel(wind), idx + 1, 0) cbName.currentIndexChanged.connect(self.slotValidate) query = Query( "select p0,p1,p2,p3 from game where seed is null and game.id = (select max(id) from game)" ) if len(query.records): with BlockSignals(self.nameWidgets): for cbName, playerId in zip(self.nameWidgets, query.records[0]): try: playerName = Players.humanNames[playerId] playerIdx = cbName.findText(playerName) if playerIdx >= 0: cbName.setCurrentIndex(playerIdx) except KeyError: logError( 'database is inconsistent: player with id %d is in game but not in player' % playerId) self.slotValidate()
def __init__(self, parent=None): super(RefineBravaiSimplerParamTab, self).__init__() localLayout = QVBoxLayout() hbox_lay_outlier_algorithm = QHBoxLayout() label_outlier_algorithm = QLabel("Outlier Rejection Algorithm") hbox_lay_outlier_algorithm.addWidget(label_outlier_algorithm) box_outlier_algorithm = QComboBox() box_outlier_algorithm.local_path = "refinement.reflections.outlier.algorithm" box_outlier_algorithm.tmp_lst = [] box_outlier_algorithm.tmp_lst.append("null") box_outlier_algorithm.tmp_lst.append("auto") box_outlier_algorithm.tmp_lst.append("mcd") box_outlier_algorithm.tmp_lst.append("tukey") box_outlier_algorithm.tmp_lst.append("sauter_poon") for lst_itm in box_outlier_algorithm.tmp_lst: box_outlier_algorithm.addItem(lst_itm) box_outlier_algorithm.setCurrentIndex(1) box_outlier_algorithm.currentIndexChanged.connect( self.combobox_changed) hbox_lay_outlier_algorithm.addWidget(box_outlier_algorithm) localLayout.addLayout(hbox_lay_outlier_algorithm) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_outlier_algorithm) self.lst_var_widg.append(label_outlier_algorithm)
def __init__(self, parent=None): super(ScaleSimplerParamTab, self).__init__() localLayout = QVBoxLayout() hbox_lay_mod = QHBoxLayout() label_mod = QLabel("Model") hbox_lay_mod.addWidget(label_mod) box_mod = QComboBox() box_mod.local_path = "model" box_mod.tmp_lst = [] box_mod.tmp_lst.append("physical") box_mod.tmp_lst.append("array") box_mod.tmp_lst.append("KB") for lst_itm in box_mod.tmp_lst: box_mod.addItem(lst_itm) box_mod.currentIndexChanged.connect(self.combobox_changed) hbox_lay_mod.addWidget(box_mod) hbox_lay_wgh_opt_err = QHBoxLayout() label_wgh_opt_err = QLabel("Optimise Errors Model") hbox_lay_wgh_opt_err.addWidget(label_wgh_opt_err) ''' weighting { error_model { error_model = *basic None ''' box_wgh_opt_err = QComboBox() box_wgh_opt_err.local_path = "weighting.error_model.error_model" box_wgh_opt_err.tmp_lst = [] box_wgh_opt_err.tmp_lst.append("basic") box_wgh_opt_err.tmp_lst.append("None") for lst_itm in box_wgh_opt_err.tmp_lst: box_wgh_opt_err.addItem(lst_itm) box_wgh_opt_err.currentIndexChanged.connect(self.combobox_changed) hbox_lay_wgh_opt_err.addWidget(box_wgh_opt_err) hbox_d_min = QHBoxLayout() d_min_label = QLabel("d_min") d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "cut_data.d_min" d_min_spn_bx.setSpecialValueText("None") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_label) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.valueChanged.connect(self.spnbox_changed) localLayout.addLayout(hbox_lay_mod) localLayout.addLayout(hbox_lay_wgh_opt_err) localLayout.addLayout(hbox_d_min) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_mod) self.lst_var_widg.append(label_mod) self.lst_var_widg.append(box_wgh_opt_err) self.lst_var_widg.append(label_wgh_opt_err) self.lst_var_widg.append(d_min_spn_bx) self.lst_var_widg.append(d_min_label)
def __init__(self, parent=None): super(IntegrateSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent localLayout = QVBoxLayout() PrFit_lay_out = QHBoxLayout() label_PrFit = QLabel("Use Profile Fitting") PrFit_lay_out.addWidget(label_PrFit) PrFit_comb_bx = QComboBox() PrFit_comb_bx.local_path = "integration.profile.fitting" PrFit_comb_bx.tmp_lst = [] PrFit_comb_bx.tmp_lst.append("True") PrFit_comb_bx.tmp_lst.append("False") PrFit_comb_bx.tmp_lst.append("Auto") for lst_itm in PrFit_comb_bx.tmp_lst: PrFit_comb_bx.addItem(lst_itm) PrFit_comb_bx.currentIndexChanged.connect(self.combobox_changed) PrFit_lay_out.addWidget(PrFit_comb_bx) localLayout.addLayout(PrFit_lay_out) hbox_lay_algorithm_53 = QHBoxLayout() label_algorithm_53 = QLabel("Background Algorithm") hbox_lay_algorithm_53.addWidget(label_algorithm_53) box_algorithm_53 = QComboBox() box_algorithm_53.local_path = "integration.background.algorithm" box_algorithm_53.tmp_lst = [] box_algorithm_53.tmp_lst.append("simple") box_algorithm_53.tmp_lst.append("null") box_algorithm_53.tmp_lst.append("median") box_algorithm_53.tmp_lst.append("gmodel") box_algorithm_53.tmp_lst.append("glm") for lst_itm in box_algorithm_53.tmp_lst: box_algorithm_53.addItem(lst_itm) box_algorithm_53.setCurrentIndex(4) box_algorithm_53.currentIndexChanged.connect(self.combobox_changed) hbox_lay_algorithm_53.addWidget(box_algorithm_53) localLayout.addLayout(hbox_lay_algorithm_53) hbox_d_min = QHBoxLayout() label_d_min = QLabel("d_min") hbox_d_min.addWidget(label_d_min) d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "prediction.d_min" d_min_spn_bx.setSpecialValueText("None") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.valueChanged.connect(self.spnbox_changed) localLayout.addLayout(hbox_d_min) hbox_lay_nproc = QHBoxLayout() label_nproc = QLabel("Number of Jobs") # label_nproc.setFont( QFont("Monospace", 10)) hbox_lay_nproc.addWidget(label_nproc) self.box_nproc = QSpinBox() self.box_nproc.local_path = "integration.mp.nproc" self.box_nproc.valueChanged.connect(self.spnbox_changed) hbox_lay_nproc.addWidget(self.box_nproc) localLayout.addLayout(hbox_lay_nproc) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.box_nproc.tmp_lst = None self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self, parent=None): super(RefineSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent localLayout = QVBoxLayout() hbox_lay_scan_varying = QHBoxLayout() label_scan_varying = QLabel("Scan Varying Refinement") hbox_lay_scan_varying.addWidget(label_scan_varying) box_scan_varying = QComboBox() box_scan_varying.local_path = "refinement.parameterisation.scan_varying" box_scan_varying.tmp_lst = [] box_scan_varying.tmp_lst.append("True") box_scan_varying.tmp_lst.append("False") box_scan_varying.tmp_lst.append("Auto") for lst_itm in box_scan_varying.tmp_lst: box_scan_varying.addItem(lst_itm) box_scan_varying.setCurrentIndex(2) box_scan_varying.currentIndexChanged.connect(self.combobox_changed) hbox_lay_scan_varying.addWidget(box_scan_varying) localLayout.addLayout(hbox_lay_scan_varying) ########################################################################### hbox_lay_outlier_algorithm = QHBoxLayout() label_outlier_algorithm = QLabel("Outlier Rejection Algorithm") hbox_lay_outlier_algorithm.addWidget(label_outlier_algorithm) box_outlier_algorithm = QComboBox() box_outlier_algorithm.local_path = "refinement.reflections.outlier.algorithm" box_outlier_algorithm.tmp_lst = [] box_outlier_algorithm.tmp_lst.append("null") box_outlier_algorithm.tmp_lst.append("auto") box_outlier_algorithm.tmp_lst.append("mcd") box_outlier_algorithm.tmp_lst.append("tukey") box_outlier_algorithm.tmp_lst.append("sauter_poon") for lst_itm in box_outlier_algorithm.tmp_lst: box_outlier_algorithm.addItem(lst_itm) box_outlier_algorithm.setCurrentIndex(1) box_outlier_algorithm.currentIndexChanged.connect( self.combobox_changed) hbox_lay_outlier_algorithm.addWidget(box_outlier_algorithm) localLayout.addLayout(hbox_lay_outlier_algorithm) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_scan_varying) self.lst_var_widg.append(label_scan_varying) # self.lst_var_widg.append(box_beam_fix) # self.lst_var_widg.append(label_beam_fix) # self.lst_var_widg.append(box_crystal_fix) # self.lst_var_widg.append(label_crystal_fix) # self.lst_var_widg.append(box_detector_fix) # self.lst_var_widg.append(label_detector_fix) # self.lst_var_widg.append(box_goniometer_fix) # self.lst_var_widg.append(label_goniometer_fix) self.lst_var_widg.append(box_outlier_algorithm) self.lst_var_widg.append(label_outlier_algorithm)
def setupPanel(self, parentWidget): logging.debug('ProstateTRUSNavUltrasound.setupPanel') self.connectorNode = self.guideletParent.connectorNode self.connectorNodeConnected = False collapsibleButton = ctkCollapsibleButton() collapsibleButton.setProperty('collapsedHeight', 20) setButtonStyle(collapsibleButton, 2.0) collapsibleButton.text = "Ultrasound" parentWidget.addWidget(collapsibleButton) ultrasoundLayout = QFormLayout(collapsibleButton) ultrasoundLayout.setContentsMargins(12, 4, 4, 4) ultrasoundLayout.setSpacing(4) self.connectDisconnectButton = QPushButton("Connect") self.connectDisconnectButton.setToolTip( "If clicked, connection OpenIGTLink") hbox = QHBoxLayout() hbox.addWidget(self.connectDisconnectButton) ultrasoundLayout.addRow(hbox) self.setupIcons() self.captureIDSelector = QComboBox() self.captureIDSelector.setToolTip("Pick capture device ID") self.captureIDSelector.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.volumeReconstructorIDSelector = QComboBox() self.volumeReconstructorIDSelector.setToolTip( "Pick volume reconstructor device ID") self.volumeReconstructorIDSelector.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopRecordingButton = QPushButton(" Start Recording") self.startStopRecordingButton.setCheckable(True) self.startStopRecordingButton.setIcon(self.recordIcon) self.startStopRecordingButton.setEnabled(False) self.startStopRecordingButton.setToolTip("If clicked, start recording") self.startStopRecordingButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) recordParametersControlsLayout = QGridLayout() self.filenameLabel = self.createLabel("Filename:", visible=False) recordParametersControlsLayout.addWidget(self.filenameLabel, 1, 0) # Offline Reconstruction self.offlineReconstructButton = QPushButton(" Offline Reconstruction") self.offlineReconstructButton.setCheckable(True) self.offlineReconstructButton.setIcon(self.recordIcon) self.offlineReconstructButton.setEnabled(False) self.offlineReconstructButton.setToolTip( "If clicked, reconstruct recorded volume") self.offlineReconstructButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.offlineVolumeToReconstructSelector = QComboBox() self.offlineVolumeToReconstructSelector.setEditable(True) self.offlineVolumeToReconstructSelector.setToolTip( "Pick/set volume to reconstruct") self.offlineVolumeToReconstructSelector.visible = False hbox = QHBoxLayout() hbox.addWidget(self.startStopRecordingButton) hbox.addWidget(self.offlineReconstructButton) ultrasoundLayout.addRow(hbox) # Scout scan (record and low resolution reconstruction) and live reconstruction # Scout scan part self.startStopScoutScanButton = QPushButton( " Scout scan\n Start recording") self.startStopScoutScanButton.setCheckable(True) self.startStopScoutScanButton.setIcon(self.recordIcon) self.startStopScoutScanButton.setToolTip("If clicked, start recording") self.startStopScoutScanButton.setEnabled(False) self.startStopScoutScanButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopLiveReconstructionButton = QPushButton( " Start live reconstruction") self.startStopLiveReconstructionButton.setCheckable(True) self.startStopLiveReconstructionButton.setIcon(self.recordIcon) self.startStopLiveReconstructionButton.setToolTip( "If clicked, start live reconstruction") self.startStopLiveReconstructionButton.setEnabled(False) self.startStopLiveReconstructionButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding) self.displayRoiButton = QToolButton() self.displayRoiButton.setCheckable(True) self.displayRoiButton.setIcon(self.visibleOffIcon) self.displayRoiButton.setToolTip("If clicked, display ROI") hbox = QHBoxLayout() hbox.addWidget(self.startStopScoutScanButton) hbox.addWidget(self.startStopLiveReconstructionButton) # hbox.addWidget(self.displayRoiButton) ultrasoundLayout.addRow(hbox) self.snapshotTimer = QTimer() self.snapshotTimer.setSingleShot(True) self.onParameterSetSelected() return collapsibleButton
def phil_list2gui(self, lst_phil_obj): sys_font = QFont() sys_font_point_size = sys_font.pointSize() inde_step = 4 self.lst_label_widg = [] self.lst_var_widg = [] non_added_lst = [] for nm, obj in enumerate(lst_phil_obj): if str(type(obj))[-11:-2] == "ScopeData": tmp_str = " " * int(obj.indent * inde_step) + str(obj.name) # print tmp_str tmp_widg = QLabel(tmp_str) tmp_widg.setAutoFillBackground(True) # tmp_widg.setPalette(self.plt_scp) tmp_widg.setFont( QFont("Monospace", sys_font_point_size, QFont.Bold)) tmp_widg.style_orign = "color: rgba(85, 85, 85, 255)" tmp_widg.setStyleSheet(tmp_widg.style_orign) self.bg_box.addWidget(tmp_widg) tmp_widg.test_flag = "Yes" self.lst_label_widg.append(tmp_widg) else: tmp_h_box = QHBoxLayout() indent = str(obj.full_path()).count(".") tmp_str = " " * indent * inde_step + str(obj.name) tmp_label = QLabel(tmp_str) tmp_label.setAutoFillBackground(True) # tmp_label.setPalette(self.plt_obj) tmp_label.style_orign = "color: rgba(0, 0, 0, 255)" tmp_label.setStyleSheet(tmp_label.style_orign) tmp_label.setFont(QFont("Monospace", sys_font_point_size)) tmp_h_box.addWidget(tmp_label) self.lst_label_widg.append(tmp_label) if (obj.type.phil_type == "bool" or obj.type.phil_type == "choice"): if obj.type.phil_type == "bool": tmp_widg = QComboBox() tmp_widg.tmp_lst = [] tmp_widg.tmp_lst.append("True") tmp_widg.tmp_lst.append("False") tmp_widg.tmp_lst.append("Auto") for lst_itm in tmp_widg.tmp_lst: tmp_widg.addItem(lst_itm) if str(obj.extract()) == "True": tmp_widg.setCurrentIndex(0) tmp_str += " True" elif str(obj.extract()) == "False": tmp_widg.setCurrentIndex(1) tmp_str += " False" elif str(obj.extract()) == "Auto": tmp_widg.setCurrentIndex(2) tmp_str += " Auto" else: tmp_str = None #print("tmp_widg.tmp_lst =", tmp_widg.tmp_lst) #print("tmp_str =", tmp_str) tmp_widg.currentIndexChanged.connect( self.combobox_changed) elif obj.type.phil_type == "choice": # remember to ask david about the issue here # tmp_widg = QComboBox() # tmp_widg.tmp_lst=[] # pos = 0 # found_choise = False # for num, opt in enumerate(obj.words): # opt = str(opt) # if(opt[0] == "*"): # found_choise = True # opt = opt[1:] # pos = num # tmp_str += " " + opt # tmp_widg.tmp_lst.append(opt) # for lst_itm in tmp_widg.tmp_lst: # tmp_widg.addItem(lst_itm) # tmp_widg.setCurrentIndex(pos) # tmp_widg.currentIndexChanged.connect(self.combobox_changed) # if(found_choise == False): # tmp_str = None # non_added_lst.append(str(obj.full_path())) # begins pathed version tmp_widg = QComboBox() tmp_widg.tmp_lst = [] pos = 0 found_choise = False for num, opt in enumerate(obj.words): opt = str(opt) if opt[0] == "*": found_choise = True opt = opt[1:] pos = num tmp_str += " " + opt tmp_widg.tmp_lst.append(opt) if not found_choise: tmp_str += " " + str( obj.extract()) for lst_itm in tmp_widg.tmp_lst: tmp_widg.addItem(lst_itm) tmp_widg.setCurrentIndex(pos) tmp_widg.currentIndexChanged.connect( self.combobox_changed) # ends pathed version else: tmp_widg = QLineEdit() tmp_widg.setText("") tmp_widg.str_defl = None tmp_widg.textChanged.connect(self.spnbox_changed) # tmp_widg.tmp_lst = None tmp_str += " " + str( obj.extract()) if tmp_str is not None: tmp_widg.local_path = str(obj.full_path()) # tmp_h_box.addStretch() tmp_h_box.addWidget(tmp_widg) self.lst_var_widg.append(tmp_widg) self.bg_box.addLayout(tmp_h_box) # debugging = ''' logger.debug("Non added parameters:") for lin_to_print in non_added_lst: logger.debug(lin_to_print)