2 Copyright (C) 1997-2017 JDERobot Developers Team 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU Library General Public License for more details. 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <http://www.gnu.org/licenses/>. 17 Authors : Okan Asik (asik.okan@gmail.com) 18 Pushkal Katara (katarapushkal@gmail.com) 22 from PyQt5.QtCore
import pyqtSignal
23 from PyQt5.QtWidgets
import QDialog, QLineEdit, QVBoxLayout, QHBoxLayout, QPushButton, \
24 QWidget, QApplication, QLabel, QComboBox, QRadioButton, \
25 QFormLayout, QTabWidget, QPlainTextEdit, QInputDialog, QFileDialog, QMessageBox
26 from PyQt5.QtGui
import QFontDatabase, QColor, QFontMetrics
27 from PyQt5.Qsci
import QsciScintilla, QsciLexerPython, QsciLexerCPP
30 namespaceChanged = pyqtSignal()
34 self.setWindowTitle(name)
39 mainLayout = QVBoxLayout()
42 self.pythonButton.setChecked(
True)
45 self.cppButton.clicked.connect(self.
cppClicked)
47 hLayout0 = QHBoxLayout()
50 container0 = QWidget()
51 container0.setLayout(hLayout0)
52 mainLayout.addWidget(container0)
60 self.tabWidget.addTab(self.
functionTab,
'Functions')
64 self.tabWidget.addTab(self.
variableTab,
'Variables')
68 self.setLayout(mainLayout)
71 self.namespace.setFunctions(functions)
72 self.namespaceChanged.emit()
75 self.namespace.setVariables(variables)
76 self.namespaceChanged.emit()
92 class FunctionsTab(QDialog):
93 functionsChanged = pyqtSignal(
'QString')
100 verticalLayout = QVBoxLayout()
102 self.setLayout(verticalLayout)
107 self.functionsChanged.emit(functions)
111 variablesChanged = pyqtSignal(
'QString')
118 verticalLayout = QVBoxLayout()
120 self.setLayout(verticalLayout)
125 self.variablesChanged.emit(variables)
128 codeChanged = pyqtSignal(
'QString')
134 self.codeEdit.setText(code)
135 fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
136 self.codeEdit.setFont(fixedWidthFont)
137 fontmetrics = QFontMetrics(fixedWidthFont)
138 self.codeEdit.setMarginWidth(0, fontmetrics.width(
"000"))
139 self.codeEdit.setMarginLineNumbers(0,
True)
140 self.codeEdit.setMarginsBackgroundColor(QColor(
"#cccccc"))
142 self.codeEdit.setBraceMatching(QsciScintilla.SloppyBraceMatch)
143 self.codeEdit.setCaretLineVisible(
True)
144 self.codeEdit.setCaretLineBackgroundColor(QColor(
"#ffe4e4"))
145 lexer = QsciLexerPython()
146 lexer.setDefaultFont(fixedWidthFont)
147 self.codeEdit.setLexer(lexer)
148 self.codeEdit.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
149 self.codeEdit.setUtf8(
True)
151 self.codeEdit.setTabWidth(4)
152 self.codeEdit.setIndentationsUseTabs(
True)
153 self.codeEdit.setIndentationGuides(
True)
154 self.codeEdit.setTabIndents(
True)
155 self.codeEdit.setAutoIndent(
True)
157 verticalLayout = QVBoxLayout()
158 verticalLayout.addWidget(self.
codeEdit)
159 self.setLayout(verticalLayout)
161 self.codeEdit.textChanged.connect(self.
changeCode)
164 self.codeChanged.emit(self.codeEdit.text())
def changeVariables(self, variables)
def variablesChanged(self, variables)
def __init__(self, name, namespace)
def changeFunctions(self, functions)
def setNamespace(self, namespace)
def __init__(self, functions)
def functionsChanged(self, functions)
def __init__(self, variables)