def connectSignals(self): # General Control Tab self.dsb_x.valueChanged.connect(self.setFieldXYZ) self.dsb_y.valueChanged.connect(self.setFieldXYZ) self.dsb_z.valueChanged.connect(self.setFieldXYZ) self.btn_clearCurrent.clicked.connect(self.clearField) self.dsb_xGradient.valueChanged.connect(self.setFieldXYZGradient) self.dsb_yGradient.valueChanged.connect(self.setFieldXYZGradient) self.dsb_zGradient.valueChanged.connect(self.setFieldXYZGradient) # Vision Tab self.highlighter = syntax.Highlighter(self.editor_vision.document()) self.chb_bypassFilters.toggled.connect(self.on_chb_bypassFilters) self.btn_refreshFilterRouting.clicked.connect(self.on_btn_refreshFilterRouting) self.btn_snapshot.clicked.connect(self.on_btn_snapshot) # object detection self.chb_objectDetection.toggled.connect(self.on_chb_objectDetection) # Subthread Tab self.cbb_subThread.currentTextChanged.connect(self.on_cbb_subThread) self.cbb_subThread.currentTextChanged.connect(self.on_chb_changeSubthread) self.cbb_subThread.currentTextChanged.connect(self.on_chb_switchSubthread) self.chb_startStopSubthread.toggled.connect(self.on_chb_startStopSubthread) self.dsb_subThreadParam0.valueChanged.connect(self.thrd.setParam0) self.dsb_subThreadParam1.valueChanged.connect(self.thrd.setParam1) self.dsb_subThreadParam2.valueChanged.connect(self.thrd.setParam2) self.dsb_subThreadParam3.valueChanged.connect(self.thrd.setParam3) self.dsb_subThreadParam4.valueChanged.connect(self.thrd.setParam4) self.dsb_desiredSeparation.valueChanged.connect(self.setDesiredSeparation)
def __init__(self, file_c): super(Edit, self).__init__() self.file_c2 = file_c ########### Setting Edit ########################### self.lis = [] self.path_ap = re.search(r".*(?=/[A-Za-z0-9_].[A-Za-z0-9_])", sys.argv[0].replace("\\", "/")).group() + "/" self.selectionChanged.connect(self.add_qu) font = QFont() font.setFamily("Consolas") font.setPointSize(11) self.setFont(font) self.setLineWrapMode(self.NoWrap) self.setTabStopWidth(40) # Completer Text # self.completer = QCompleter(self) if self.file_c2: li = open(self.path_ap + "key/keyword", "r").read().split("\n") li.sort() self.completer.setModel(QStringListModel(li)) self.highlighter = syntax.Highlighter(self.document()) self.completer.setModelSorting( QCompleter.CaseInsensitivelySortedModel) self.completer.setWrapAround(True) self.setCompleter(self.completer) self.cursorPositionChanged.connect(self.positionInBlock) ############################### self.lineNumberArea = LineNumberArea(self) self.connect(self, SIGNAL('blockCountChanged(int)'), self.updateLineNumberAreaWidth) self.connect(self, SIGNAL('updateRequest(QRect,int)'), self.updateLineNumberArea) self.connect(self, SIGNAL('cursorPositionChanged()'), self.highlightCurrentLine) self.updateLineNumberAreaWidth(0)
def __init__(self, parent=None): super(LogCat, self).__init__(parent) self.layout = QVBoxLayout(self) self.lineedit = QLineEdit(self) self.textedit = LNTextEdit(self) self.textedit.edit.setReadOnly(True) self.layout.addWidget(self.lineedit) self.layout.addWidget(self.textedit) self.layout.setContentsMargins(2, 2, 2, 2) self.layout.setSpacing(2) self.resize(600, 300) self.setWindowTitle('LogCat v%s - Uncle Han' % __VERSION__) # self.setupUI() self.setLayout(self.layout) sys.stdout = self.textedit self.id = mo.MCommandMessage.addCommandOutputCallback( self.callback, None) self.highlight = syntax.Highlighter(self.textedit.edit.document()) self.textedit.regex = None self.lineedit.textChanged.connect(self.update_regex_str)
def connectSignals(self): # XYZ Mode Tab self.dsb_x.valueChanged.connect(self.setField) self.dsb_y.valueChanged.connect(self.setField) self.dsb_z.valueChanged.connect(self.setField) self.dsb_pxpx.valueChanged.connect(self.setField) self.dsb_pxpy.valueChanged.connect(self.setField) self.dsb_pxpz.valueChanged.connect(self.setField) self.dsb_pypy.valueChanged.connect(self.setField) self.dsb_pypz.valueChanged.connect(self.setField) self.btn_clearCurrent.clicked.connect(self.clearField) # Angle Mode Tab self.dsb_mag.valueChanged.connect(self.setFieldByAngle) self.dsb_azimuth.valueChanged.connect(self.setFieldByAngle) self.dsb_polar.valueChanged.connect(self.setFieldByAngle) # Vision Tab self.highlighter = syntax.Highlighter(self.editor_vision.document()) self.chb_bypassFilters.toggled.connect(self.on_chb_bypassFilters) self.chb_startPauseCapture.toggled.connect( self.on_chb_startPauseCapture) self.btn_refreshFilterRouting.clicked.connect( self.on_btn_refreshFilterRouting) # object detection self.chb_objectDetection.toggled.connect(self.on_chb_objectDetection) # Subthread Tab self.cbb_subThread.currentTextChanged.connect(self.on_cbb_subThread) self.chb_startStopSubthread.toggled.connect( self.on_chb_startStopSubthread) self.dsb_subThreadParam0.valueChanged.connect(self.thrd.setParam0) self.dsb_subThreadParam1.valueChanged.connect(self.thrd.setParam1) self.dsb_subThreadParam2.valueChanged.connect(self.thrd.setParam2) self.dsb_subThreadParam3.valueChanged.connect(self.thrd.setParam3) self.dsb_subThreadParam4.valueChanged.connect(self.thrd.setParam4)
def saveFile_c(self): wedit = self.currentWidget() doc = wedit.document() if doc.isModified(): if os.path.exists(self.tabToolTip(self.currentIndex())): open(self.tabToolTip(self.currentIndex()), "w").write(wedit.toPlainText()) doc.setModified(False) else: fSpath, ok = QFileDialog.getSaveFileName( self, "Save File", "*.c") if fSpath: if self.tabText(self.currentIndex()) in self.DFName: self.DFName.pop(self.tabText(self.currentIndex())) fname = fSpath.split("/")[-1] open(fSpath, "w").write(wedit.toPlainText()) if fSpath.endswith(".c"): self.highlighter = syntax.Highlighter(wedit.document()) wedit.file_c2 = True self.DFName.update({fname: [fSpath, self.currentIndex()]}) self.setTabText(self.currentIndex(), fname) self.setTabToolTip(self.currentIndex(), fSpath) doc.setModified(False) else: if os.path.exists(self.tabToolTip(self.currentIndex())): open(self.tabToolTip(self.currentIndex()), "w").write(wedit.toPlainText()) doc.setModified(False) else: fSpath, ok = QFileDialog.getSaveFileName( self, "Save File", "*.c") if fSpath: if self.tabText(self.currentIndex()) in self.DFName: self.DFName.pop(self.tabText(self.currentIndex())) fname = fSpath.split("/")[-1] open(fSpath, "w").write(wedit.toPlainText()) if fSpath.endswith(".c"): self.highlighter = syntax.Highlighter(wedit.document()) wedit.file_c2 = True self.DFName.update({fname: [fSpath, self.currentIndex()]}) self.setTabText(self.currentIndex(), fname) self.setTabToolTip(self.currentIndex(), fSpath) doc.setModified(False)
def setupCallbacksEditor(self): self.currentFilePath = '' self.btn_editor_update.clicked.connect(self.on_btn_editor_update) self.highlighter = syntax.Highlighter(self.editor.document())