def mousePressPathHelix(self, pathHelix, event): strandType, idx = self.baseAtPoint(pathHelix, event.pos()) dialog = QInputDialog(self.window()) dialog.setWindowFlags(Qt.Dialog | Qt.Sheet) dialog.setWindowModality(Qt.WindowModal) dialog.setLabelText('Choose the sequence to be applied from 5\' to 3\' in the\n oligo you clicked on by name, or enter a sequence by hand:') dialog.setWindowTitle('Choose Sequence') dialog.setComboBoxEditable(True) dialog.setComboBoxItems(sequences.keys()) dialog.open(self, SLOT("userChoseSeq(QString)")) self.dialog = dialog self.vh = pathHelix.vhelix() self.strandType = strandType self.idx = idx
def initDialog(self): """ 1. Create buttons according to available scaffold sequences and add them to the dialog. 2. Map the clicked signal of those buttons to keep track of what sequence gets selected. 3. Watch the tabWidget change signal to determine whether a standard or custom sequence should be applied. """ uiDlg = Ui_AddSeqDialog() uiDlg.setupUi(self.dialog) self.signalMapper = QSignalMapper(self) # set up the radio buttons for i, name in enumerate(sorted(sequences.keys())): radioButton = QRadioButton(uiDlg.groupBox) radioButton.setObjectName(name + "Button") radioButton.setText(name) self.buttons.append(radioButton) uiDlg.verticalLayout.addWidget(radioButton) self.signalMapper.setMapping(radioButton, i) radioButton.clicked.connect(self.signalMapper.map) self.signalMapper.mapped.connect(self.standardSequenceChangedSlot) uiDlg.tabWidget.currentChanged.connect(self.tabWidgetChangedSlot) # disable apply until valid option or custom sequence is chosen self.applyButton = uiDlg.customButtonBox.button(QDialogButtonBox.Apply) self.applyButton.setEnabled(False) # watch sequence textedit box to validate custom sequences self.seqBox = uiDlg.seqTextEdit self.seqBox.textChanged.connect(self.validateCustomSequence) self.highlighter = DNAHighlighter(self.seqBox) # finally, pre-click the M13mp18 radio button self.buttons[0].click() buttons = self.buttons self.dialog.setFocusProxy(uiDlg.groupBox) self.dialog.setFocusPolicy(Qt.TabFocus) uiDlg.groupBox.setFocusPolicy(Qt.TabFocus) for i in range(len(buttons) - 1): uiDlg.groupBox.setTabOrder(buttons[i], buttons[i + 1])
def initDialog(self): """ 1. Create buttons according to available scaffold sequences and add them to the dialog. 2. Map the clicked signal of those buttons to keep track of what sequence gets selected. 3. Watch the tabWidget change signal to determine whether a standard or custom sequence should be applied. """ uiDlg = Ui_AddSeqDialog() uiDlg.setupUi(self.dialog) self.signalMapper = QSignalMapper(self) # set up the radio buttons for i, name in enumerate(sorted(sequences.keys())): radioButton = QRadioButton(uiDlg.groupBox) radioButton.setObjectName(name + "Button") radioButton.setText(name) self.buttons.append(radioButton) uiDlg.verticalLayout.addWidget(radioButton) self.signalMapper.setMapping(radioButton, i) radioButton.clicked.connect(self.signalMapper.map) self.signalMapper.mapped.connect(self.standardSequenceChangedSlot) uiDlg.tabWidget.currentChanged.connect(self.tabWidgetChangedSlot) # disable apply until valid option or custom sequence is chosen self.applyButton = uiDlg.customButtonBox.button(QDialogButtonBox.Apply) self.applyButton.setEnabled(False) # watch sequence textedit box to validate custom sequences self.seqBox = uiDlg.seqTextEdit self.seqBox.textChanged.connect(self.validateCustomSequence) self.highlighter = DNAHighlighter(self.seqBox) # finally, pre-click the M13mp18 radio button self.buttons[0].click() buttons = self.buttons self.dialog.setFocusProxy(uiDlg.groupBox) self.dialog.setFocusPolicy(Qt.TabFocus) uiDlg.groupBox.setFocusPolicy(Qt.TabFocus) for i in range(len(buttons)-1): uiDlg.groupBox.setTabOrder(buttons[i], buttons[i+1])