def __init__(self, parent=None): super(OutputDock, self).__init__(parent) self.initDock("Output") self.iconsole = PyInteractiveConsole(self) self.iconsole.setLineWrapMode(self.iconsole.WidgetWidth) self.contents = QtWidgets.QWidget() self.layout = QtWidgets.QGridLayout(self.contents) self.layout.addWidget(self.iconsole, 0, 0, 1, 1) self.setWidget(self.contents)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(924, 971) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/QIdle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.codeEdit = PyCodeEdit(self.centralwidget) self.codeEdit.setObjectName("codeEdit") self.gridLayout.addWidget(self.codeEdit, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.dockWidgetClassExplorer = QtWidgets.QDockWidget(MainWindow) self.dockWidgetClassExplorer.setObjectName("dockWidgetClassExplorer") self.dockWidgetContents_2 = QtWidgets.QWidget() self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2) self.gridLayout_3.setObjectName("gridLayout_3") self.classExplorer = PyOutlineTreeWidget(self.dockWidgetContents_2) self.classExplorer.setObjectName("classExplorer") self.classExplorer.headerItem().setText(0, "1") self.classExplorer.header().setVisible(False) self.gridLayout_3.addWidget(self.classExplorer, 0, 0, 1, 1) self.dockWidgetClassExplorer.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidgetClassExplorer) self.dockWidgetProgramOutput = QtWidgets.QDockWidget(MainWindow) self.dockWidgetProgramOutput.setObjectName("dockWidgetProgramOutput") self.dockWidgetContents_3 = QtWidgets.QWidget() self.dockWidgetContents_3.setObjectName("dockWidgetContents_3") self.gridLayout_4 = QtWidgets.QGridLayout(self.dockWidgetContents_3) self.gridLayout_4.setObjectName("gridLayout_4") self.textEditPgmOutput = PyInteractiveConsole( self.dockWidgetContents_3) self.textEditPgmOutput.setObjectName("textEditPgmOutput") self.gridLayout_4.addWidget(self.textEditPgmOutput, 0, 0, 1, 1) self.dockWidgetProgramOutput.setWidget(self.dockWidgetContents_3) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidgetProgramOutput) self.dockWidgetPyConsole = QtWidgets.QDockWidget(MainWindow) self.dockWidgetPyConsole.setObjectName("dockWidgetPyConsole") self.dockWidgetContents_4 = QtWidgets.QWidget() self.dockWidgetContents_4.setObjectName("dockWidgetContents_4") self.gridLayout_5 = QtWidgets.QGridLayout(self.dockWidgetContents_4) self.gridLayout_5.setObjectName("gridLayout_5") self.pyconsole = IPythonConsole(self.dockWidgetContents_4) self.pyconsole.setObjectName("pyconsole") self.gridLayout_5.addWidget(self.pyconsole, 0, 0, 1, 1) self.dockWidgetPyConsole.setWidget(self.dockWidgetContents_4) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidgetPyConsole) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 924, 34)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuRecents = QtWidgets.QMenu(self.menuFile) self.menuRecents.setObjectName("menuRecents") self.menuRun = QtWidgets.QMenu(self.menubar) self.menuRun.setObjectName("menuRun") self.menuOptions = QtWidgets.QMenu(self.menubar) self.menuOptions.setObjectName("menuOptions") self.menuWindows = QtWidgets.QMenu(self.menubar) self.menuWindows.setObjectName("menuWindows") self.menuTools = QtWidgets.QMenu(self.menuWindows) self.menuTools.setObjectName("menuTools") self.menuHelp = QtWidgets.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") MainWindow.setMenuBar(self.menubar) self.toolBarSave = QtWidgets.QToolBar(MainWindow) self.toolBarSave.setObjectName("toolBarSave") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarSave) self.toolBarRun = QtWidgets.QToolBar(MainWindow) self.toolBarRun.setObjectName("toolBarRun") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarRun) self.actionOpen_file = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-open") self.actionOpen_file.setIcon(icon) self.actionOpen_file.setObjectName("actionOpen_file") self.actionOpen_directory = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("folder-open") self.actionOpen_directory.setIcon(icon) self.actionOpen_directory.setObjectName("actionOpen_directory") self.actionSave = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-save") self.actionSave.setIcon(icon) self.actionSave.setObjectName("actionSave") self.actionSave_as = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-save-as") self.actionSave_as.setIcon(icon) self.actionSave_as.setObjectName("actionSave_as") self.actionClose = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("window-close") self.actionClose.setIcon(icon) self.actionClose.setObjectName("actionClose") self.actionQuit = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("exit") self.actionQuit.setIcon(icon) self.actionQuit.setObjectName("actionQuit") self.actionRun = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("media-playback-start") self.actionRun.setIcon(icon) self.actionRun.setObjectName("actionRun") self.actionConfigureRun = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("system-run") self.actionConfigureRun.setIcon(icon) self.actionConfigureRun.setObjectName("actionConfigureRun") self.actionConfigure_IDLE = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("preferences-system") self.actionConfigure_IDLE.setIcon(icon) self.actionConfigure_IDLE.setObjectName("actionConfigure_IDLE") self.actionZoom_height = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("zoom-fit-best") self.actionZoom_height.setIcon(icon) self.actionZoom_height.setObjectName("actionZoom_height") self.actionAbout_QIdle = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("help-about") self.actionAbout_QIdle.setIcon(icon) self.actionAbout_QIdle.setObjectName("actionAbout_QIdle") self.actionHelp_content = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("help-contents") self.actionHelp_content.setIcon(icon) self.actionHelp_content.setObjectName("actionHelp_content") self.actionPython_docs = QtWidgets.QAction(MainWindow) self.actionPython_docs.setObjectName("actionPython_docs") self.actionNew_file = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-new") self.actionNew_file.setIcon(icon) self.actionNew_file.setObjectName("actionNew_file") self.actionNew_project = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("folder-new") self.actionNew_project.setIcon(icon) self.actionNew_project.setObjectName("actionNew_project") self.menuFile.addAction(self.actionNew_file) self.menuFile.addAction(self.actionOpen_file) self.menuFile.addSeparator() self.menuFile.addAction(self.actionNew_project) self.menuFile.addAction(self.actionOpen_directory) self.menuFile.addSeparator() self.menuFile.addAction(self.menuRecents.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSave_as) self.menuFile.addSeparator() self.menuFile.addAction(self.actionClose) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuRun.addAction(self.actionRun) self.menuRun.addAction(self.actionConfigureRun) self.menuOptions.addAction(self.actionConfigure_IDLE) self.menuWindows.addAction(self.actionZoom_height) self.menuWindows.addSeparator() self.menuWindows.addAction(self.menuTools.menuAction()) self.menuWindows.addSeparator() self.menuHelp.addAction(self.actionAbout_QIdle) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionHelp_content) self.menuHelp.addAction(self.actionPython_docs) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuRun.menuAction()) self.menubar.addAction(self.menuOptions.menuAction()) self.menubar.addAction(self.menuWindows.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.toolBarSave.addAction(self.actionNew_file) self.toolBarSave.addAction(self.actionOpen_file) self.toolBarSave.addSeparator() self.toolBarSave.addAction(self.actionSave) self.toolBarSave.addAction(self.actionSave_as) self.toolBarRun.addAction(self.actionConfigureRun) self.toolBarRun.addAction(self.actionRun) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(847, 649) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/pyqode.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setHorizontalSpacing(0) self.gridLayout.setObjectName("gridLayout") self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget) self.tabWidget.setObjectName("tabWidget") self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 847, 27)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuPython_interpreter = QtWidgets.QMenu(self.menuFile) self.menuPython_interpreter.setObjectName("menuPython_interpreter") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") self.menuModes = QtWidgets.QMenu(self.menubar) self.menuModes.setObjectName("menuModes") self.menuPanels = QtWidgets.QMenu(self.menubar) self.menuPanels.setObjectName("menuPanels") self.menu = QtWidgets.QMenu(self.menubar) self.menu.setObjectName("menu") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.toolBar = QtWidgets.QToolBar(MainWindow) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.dockWidget = QtWidgets.QDockWidget(MainWindow) self.dockWidget.setObjectName("dockWidget") self.dockWidgetContents = QtWidgets.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents) self.gridLayout_2.setObjectName("gridLayout_2") self.interactiveConsole = PyInteractiveConsole(self.dockWidgetContents) self.interactiveConsole.setObjectName("interactiveConsole") self.gridLayout_2.addWidget(self.interactiveConsole, 0, 0, 1, 1) self.dockWidget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidget) self.dockWidgetOutline = QtWidgets.QDockWidget(MainWindow) self.dockWidgetOutline.setObjectName("dockWidgetOutline") self.dockWidgetContents_2 = QtWidgets.QWidget() self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2) self.gridLayout_3.setObjectName("gridLayout_3") self.widgetOutline = OutlineTreeWidget(self.dockWidgetContents_2) self.widgetOutline.setObjectName("widgetOutline") self.gridLayout_3.addWidget(self.widgetOutline, 0, 0, 1, 1) self.dockWidgetOutline.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidgetOutline) self.actionNew = QtWidgets.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/icons/document-new.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionNew.setIcon(icon1) self.actionNew.setIconVisibleInMenu(True) self.actionNew.setObjectName("actionNew") self.actionOpen = QtWidgets.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icons/document-open.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen.setIcon(icon2) self.actionOpen.setIconVisibleInMenu(True) self.actionOpen.setObjectName("actionOpen") self.actionSave = QtWidgets.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/icons/document-save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave.setIcon(icon3) self.actionSave.setIconVisibleInMenu(True) self.actionSave.setObjectName("actionSave") self.actionSave_as = QtWidgets.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/icons/document-save-as.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave_as.setIcon(icon4) self.actionSave_as.setIconVisibleInMenu(True) self.actionSave_as.setObjectName("actionSave_as") self.actionQuit = QtWidgets.QAction(MainWindow) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/icons/close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionQuit.setIcon(icon5) self.actionQuit.setIconVisibleInMenu(True) self.actionQuit.setObjectName("actionQuit") self.actionAbout = QtWidgets.QAction(MainWindow) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/icons/about.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionAbout.setIcon(icon6) self.actionAbout.setIconVisibleInMenu(True) self.actionAbout.setObjectName("actionAbout") self.actionRun = QtWidgets.QAction(MainWindow) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(":/icons/Gnome-Media-Playback-Start.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRun.setIcon(icon7) self.actionRun.setIconVisibleInMenu(True) self.actionRun.setObjectName("actionRun") self.actionConfigure_run = QtWidgets.QAction(MainWindow) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(":/icons/Gnome-System-Run.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionConfigure_run.setIcon(icon8) self.actionConfigure_run.setIconVisibleInMenu(True) self.actionConfigure_run.setObjectName("actionConfigure_run") self.actionPython_2 = QtWidgets.QAction(MainWindow) self.actionPython_2.setObjectName("actionPython_2") self.actionPython_3 = QtWidgets.QAction(MainWindow) self.actionPython_3.setObjectName("actionPython_3") self.menuFile.addAction(self.actionNew) self.menuFile.addAction(self.actionOpen) self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSave_as) self.menuFile.addSeparator() self.menuFile.addAction(self.actionConfigure_run) self.menuFile.addAction(self.actionRun) self.menuFile.addSeparator() self.menuFile.addAction(self.menuPython_interpreter.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menu.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuModes.menuAction()) self.menubar.addAction(self.menuPanels.menuAction()) self.menubar.addAction(self.menu.menuAction()) self.toolBar.addAction(self.actionNew) self.toolBar.addAction(self.actionOpen) self.toolBar.addSeparator() self.toolBar.addAction(self.actionSave) self.toolBar.addAction(self.actionSave_as) self.toolBar.addSeparator() self.toolBar.addAction(self.actionConfigure_run) self.toolBar.addAction(self.actionRun) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
""" import os import sys from pyqode.core.api import TextHelper from pyqode.qt import QtWidgets from pyqode.python.widgets import PyInteractiveConsole, PyCodeEdit editor_windows = [] def open_editor(path, line): global editor_windows print(path, line) editor = PyCodeEdit() # prevent the restoration of cursor position which will reset the position # we will set after opening the file editor.file.restore_cursor = False editor.file.open(path) TextHelper(editor).goto_line(line) editor.show() editor_windows.append(editor) app = QtWidgets.QApplication(sys.argv) console = PyInteractiveConsole() console.open_file_requested.connect(open_editor) console.start_process(sys.executable, [os.path.join(os.getcwd(), "interactive_process.py")]) console.show() app.exec_()
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(938, 638) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/QIdle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget) self.tabWidget.setObjectName("tabWidget") self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.dockWidgetFiles = QtWidgets.QDockWidget(MainWindow) self.dockWidgetFiles.setObjectName("dockWidgetFiles") self.dockWidgetContents = QtWidgets.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents) self.gridLayout_2.setObjectName("gridLayout_2") self.fsTree = FileSystemTreeView(self.dockWidgetContents) self.fsTree.setObjectName("fsTree") self.gridLayout_2.addWidget(self.fsTree, 0, 0, 1, 1) self.dockWidgetFiles.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidgetFiles) self.dockWidgetClassExplorer = QtWidgets.QDockWidget(MainWindow) self.dockWidgetClassExplorer.setObjectName("dockWidgetClassExplorer") self.dockWidgetContents_2 = QtWidgets.QWidget() self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2) self.gridLayout_3.setObjectName("gridLayout_3") self.classExplorer = PyOutlineTreeWidget(self.dockWidgetContents_2) self.classExplorer.setObjectName("classExplorer") self.classExplorer.headerItem().setText(0, "1") self.classExplorer.header().setVisible(False) self.gridLayout_3.addWidget(self.classExplorer, 0, 0, 1, 1) self.dockWidgetClassExplorer.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidgetClassExplorer) self.dockWidgetProgramOutput = QtWidgets.QDockWidget(MainWindow) self.dockWidgetProgramOutput.setObjectName("dockWidgetProgramOutput") self.dockWidgetContents_3 = QtWidgets.QWidget() self.dockWidgetContents_3.setObjectName("dockWidgetContents_3") self.gridLayout_4 = QtWidgets.QGridLayout(self.dockWidgetContents_3) self.gridLayout_4.setObjectName("gridLayout_4") self.textEditPgmOutput = PyInteractiveConsole(self.dockWidgetContents_3) self.textEditPgmOutput.setObjectName("textEditPgmOutput") self.gridLayout_4.addWidget(self.textEditPgmOutput, 0, 0, 1, 1) self.dockWidgetProgramOutput.setWidget(self.dockWidgetContents_3) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidgetProgramOutput) self.dockWidgetPyConsole = QtWidgets.QDockWidget(MainWindow) self.dockWidgetPyConsole.setObjectName("dockWidgetPyConsole") self.dockWidgetContents_4 = QtWidgets.QWidget() self.dockWidgetContents_4.setObjectName("dockWidgetContents_4") self.gridLayout_5 = QtWidgets.QGridLayout(self.dockWidgetContents_4) self.gridLayout_5.setObjectName("gridLayout_5") self.pyconsole = IPythonConsole(self.dockWidgetContents_4) self.pyconsole.setObjectName("pyconsole") self.gridLayout_5.addWidget(self.pyconsole, 0, 0, 1, 1) self.dockWidgetPyConsole.setWidget(self.dockWidgetContents_4) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidgetPyConsole) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 938, 34)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuRecents = QtWidgets.QMenu(self.menuFile) self.menuRecents.setObjectName("menuRecents") self.menuRun = QtWidgets.QMenu(self.menubar) self.menuRun.setObjectName("menuRun") self.menuOptions = QtWidgets.QMenu(self.menubar) self.menuOptions.setObjectName("menuOptions") self.menuWindows = QtWidgets.QMenu(self.menubar) self.menuWindows.setObjectName("menuWindows") self.menuTools = QtWidgets.QMenu(self.menuWindows) self.menuTools.setObjectName("menuTools") self.menuHelp = QtWidgets.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") MainWindow.setMenuBar(self.menubar) self.toolBarSave = QtWidgets.QToolBar(MainWindow) self.toolBarSave.setObjectName("toolBarSave") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarSave) self.toolBarRun = QtWidgets.QToolBar(MainWindow) self.toolBarRun.setObjectName("toolBarRun") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarRun) self.actionOpen_file = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-open") self.actionOpen_file.setIcon(icon) self.actionOpen_file.setObjectName("actionOpen_file") self.actionOpen_directory = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("folder-open") self.actionOpen_directory.setIcon(icon) self.actionOpen_directory.setObjectName("actionOpen_directory") self.actionSave = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-save") self.actionSave.setIcon(icon) self.actionSave.setObjectName("actionSave") self.actionSave_as = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-save-as") self.actionSave_as.setIcon(icon) self.actionSave_as.setObjectName("actionSave_as") self.actionClose = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("window-close") self.actionClose.setIcon(icon) self.actionClose.setObjectName("actionClose") self.actionQuit = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("exit") self.actionQuit.setIcon(icon) self.actionQuit.setObjectName("actionQuit") self.actionRun = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("media-playback-start") self.actionRun.setIcon(icon) self.actionRun.setObjectName("actionRun") self.actionConfigureRun = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("system-run") self.actionConfigureRun.setIcon(icon) self.actionConfigureRun.setObjectName("actionConfigureRun") self.actionConfigure_IDLE = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("preferences-system") self.actionConfigure_IDLE.setIcon(icon) self.actionConfigure_IDLE.setObjectName("actionConfigure_IDLE") self.actionZoom_height = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("zoom-fit-best") self.actionZoom_height.setIcon(icon) self.actionZoom_height.setObjectName("actionZoom_height") self.actionAbout_QIdle = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("help-about") self.actionAbout_QIdle.setIcon(icon) self.actionAbout_QIdle.setObjectName("actionAbout_QIdle") self.actionHelp_content = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("help-contents") self.actionHelp_content.setIcon(icon) self.actionHelp_content.setObjectName("actionHelp_content") self.actionPython_docs = QtWidgets.QAction(MainWindow) self.actionPython_docs.setObjectName("actionPython_docs") self.actionNew_file = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("document-new") self.actionNew_file.setIcon(icon) self.actionNew_file.setObjectName("actionNew_file") self.actionNew_project = QtWidgets.QAction(MainWindow) icon = QtGui.QIcon.fromTheme("folder-new") self.actionNew_project.setIcon(icon) self.actionNew_project.setObjectName("actionNew_project") self.menuFile.addAction(self.actionNew_file) self.menuFile.addAction(self.actionOpen_file) self.menuFile.addSeparator() self.menuFile.addAction(self.actionNew_project) self.menuFile.addAction(self.actionOpen_directory) self.menuFile.addSeparator() self.menuFile.addAction(self.menuRecents.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSave_as) self.menuFile.addSeparator() self.menuFile.addAction(self.actionClose) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuRun.addAction(self.actionRun) self.menuRun.addAction(self.actionConfigureRun) self.menuOptions.addAction(self.actionConfigure_IDLE) self.menuWindows.addAction(self.actionZoom_height) self.menuWindows.addSeparator() self.menuWindows.addAction(self.menuTools.menuAction()) self.menuWindows.addSeparator() self.menuHelp.addAction(self.actionAbout_QIdle) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionHelp_content) self.menuHelp.addAction(self.actionPython_docs) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuRun.menuAction()) self.menubar.addAction(self.menuOptions.menuAction()) self.menubar.addAction(self.menuWindows.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.toolBarSave.addAction(self.actionSave) self.toolBarSave.addAction(self.actionSave_as) self.toolBarRun.addAction(self.actionRun) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "QIdle")) self.dockWidgetFiles.setWindowTitle(_translate("MainWindow", "Files")) self.dockWidgetClassExplorer.setWindowTitle(_translate("MainWindow", "Structure")) self.dockWidgetProgramOutput.setWindowTitle(_translate("MainWindow", "Program output")) self.dockWidgetPyConsole.setWindowTitle(_translate("MainWindow", "Python console")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuRecents.setTitle(_translate("MainWindow", "Recents")) self.menuRun.setTitle(_translate("MainWindow", "Run")) self.menuOptions.setTitle(_translate("MainWindow", "Options")) self.menuWindows.setTitle(_translate("MainWindow", "Windows")) self.menuTools.setTitle(_translate("MainWindow", "Tools")) self.menuHelp.setTitle(_translate("MainWindow", "Help")) self.menuEdit.setTitle(_translate("MainWindow", "Edit")) self.toolBarSave.setWindowTitle(_translate("MainWindow", "File toolbar")) self.toolBarRun.setWindowTitle(_translate("MainWindow", "Run toolbar")) self.actionOpen_file.setText(_translate("MainWindow", "Open script")) self.actionOpen_file.setToolTip(_translate("MainWindow", "Open an existing script in a new window")) self.actionOpen_directory.setText(_translate("MainWindow", "Open project")) self.actionOpen_directory.setToolTip(_translate("MainWindow", "Open/import exisiting project\n" "\n" "You can open any directory, even with projects created in other IDE!")) self.actionSave.setText(_translate("MainWindow", "Save")) self.actionSave_as.setText(_translate("MainWindow", "Save as")) self.actionClose.setText(_translate("MainWindow", "Close window")) self.actionQuit.setText(_translate("MainWindow", "Quit")) self.actionRun.setText(_translate("MainWindow", "Run")) self.actionRun.setToolTip(_translate("MainWindow", "Run the selected configuration")) self.actionConfigureRun.setText(_translate("MainWindow", "Edit configurations")) self.actionConfigureRun.setToolTip(_translate("MainWindow", "Edit run configurations")) self.actionConfigure_IDLE.setText(_translate("MainWindow", "Configure QIdle")) self.actionZoom_height.setText(_translate("MainWindow", "Zoom height")) self.actionAbout_QIdle.setText(_translate("MainWindow", "About QIdle")) self.actionHelp_content.setText(_translate("MainWindow", "QIdle Help")) self.actionPython_docs.setText(_translate("MainWindow", "Python docs")) self.actionNew_file.setText(_translate("MainWindow", "New file")) self.actionNew_file.setToolTip(_translate("MainWindow", "Create a new script (in a new window)")) self.actionNew_project.setText(_translate("MainWindow", "New project")) self.actionNew_project.setToolTip(_translate("MainWindow", "Create a new project"))
""" import os import sys from pyqode.core.api import TextHelper from pyqode.qt import QtWidgets from pyqode.python.widgets import PyInteractiveConsole, PyCodeEdit editor_windows = [] def open_editor(path, line): global editor_windows print(path, line) editor = PyCodeEdit() # prevent the restoration of cursor position which will reset the position # we will set after opening the file editor.file.restore_cursor = False editor.file.open(path) TextHelper(editor).goto_line(line) editor.show() editor_windows.append(editor) app = QtWidgets.QApplication(sys.argv) console = PyInteractiveConsole() console.open_file_requested.connect(open_editor) console.start_process(sys.executable, [os.path.join(os.getcwd(), 'interactive_process.py')]) console.show() app.exec_()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(847, 649) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/pyqode.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setHorizontalSpacing(0) self.gridLayout.setObjectName("gridLayout") self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget) self.tabWidget.setObjectName("tabWidget") self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 847, 27)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuPython_interpreter = QtWidgets.QMenu(self.menuFile) self.menuPython_interpreter.setObjectName("menuPython_interpreter") self.menuEdit = QtWidgets.QMenu(self.menubar) self.menuEdit.setObjectName("menuEdit") self.menuModes = QtWidgets.QMenu(self.menubar) self.menuModes.setObjectName("menuModes") self.menuPanels = QtWidgets.QMenu(self.menubar) self.menuPanels.setObjectName("menuPanels") self.menu = QtWidgets.QMenu(self.menubar) self.menu.setObjectName("menu") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.toolBar = QtWidgets.QToolBar(MainWindow) self.toolBar.setObjectName("toolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.dockWidget = QtWidgets.QDockWidget(MainWindow) self.dockWidget.setObjectName("dockWidget") self.dockWidgetContents = QtWidgets.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents) self.gridLayout_2.setObjectName("gridLayout_2") self.interactiveConsole = PyInteractiveConsole(self.dockWidgetContents) self.interactiveConsole.setObjectName("interactiveConsole") self.gridLayout_2.addWidget(self.interactiveConsole, 0, 0, 1, 1) self.dockWidget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidget) self.dockWidgetOutline = QtWidgets.QDockWidget(MainWindow) self.dockWidgetOutline.setObjectName("dockWidgetOutline") self.dockWidgetContents_2 = QtWidgets.QWidget() self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2) self.gridLayout_3.setObjectName("gridLayout_3") self.widgetOutline = OutlineTreeWidget(self.dockWidgetContents_2) self.widgetOutline.setObjectName("widgetOutline") self.gridLayout_3.addWidget(self.widgetOutline, 0, 0, 1, 1) self.dockWidgetOutline.setWidget(self.dockWidgetContents_2) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidgetOutline) self.actionNew = QtWidgets.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/icons/document-new.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionNew.setIcon(icon1) self.actionNew.setIconVisibleInMenu(True) self.actionNew.setObjectName("actionNew") self.actionOpen = QtWidgets.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icons/document-open.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionOpen.setIcon(icon2) self.actionOpen.setIconVisibleInMenu(True) self.actionOpen.setObjectName("actionOpen") self.actionSave = QtWidgets.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/icons/document-save.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave.setIcon(icon3) self.actionSave.setIconVisibleInMenu(True) self.actionSave.setObjectName("actionSave") self.actionSave_as = QtWidgets.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/icons/document-save-as.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave_as.setIcon(icon4) self.actionSave_as.setIconVisibleInMenu(True) self.actionSave_as.setObjectName("actionSave_as") self.actionQuit = QtWidgets.QAction(MainWindow) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/icons/close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionQuit.setIcon(icon5) self.actionQuit.setIconVisibleInMenu(True) self.actionQuit.setObjectName("actionQuit") self.actionAbout = QtWidgets.QAction(MainWindow) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/icons/about.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionAbout.setIcon(icon6) self.actionAbout.setIconVisibleInMenu(True) self.actionAbout.setObjectName("actionAbout") self.actionRun = QtWidgets.QAction(MainWindow) icon7 = QtGui.QIcon() icon7.addPixmap( QtGui.QPixmap(":/icons/Gnome-Media-Playback-Start.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionRun.setIcon(icon7) self.actionRun.setIconVisibleInMenu(True) self.actionRun.setObjectName("actionRun") self.actionConfigure_run = QtWidgets.QAction(MainWindow) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(":/icons/Gnome-System-Run.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionConfigure_run.setIcon(icon8) self.actionConfigure_run.setIconVisibleInMenu(True) self.actionConfigure_run.setObjectName("actionConfigure_run") self.actionPython_2 = QtWidgets.QAction(MainWindow) self.actionPython_2.setObjectName("actionPython_2") self.actionPython_3 = QtWidgets.QAction(MainWindow) self.actionPython_3.setObjectName("actionPython_3") self.menuFile.addAction(self.actionNew) self.menuFile.addAction(self.actionOpen) self.menuFile.addAction(self.actionSave) self.menuFile.addAction(self.actionSave_as) self.menuFile.addSeparator() self.menuFile.addAction(self.actionConfigure_run) self.menuFile.addAction(self.actionRun) self.menuFile.addSeparator() self.menuFile.addAction(self.menuPython_interpreter.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menu.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuModes.menuAction()) self.menubar.addAction(self.menuPanels.menuAction()) self.menubar.addAction(self.menu.menuAction()) self.toolBar.addAction(self.actionNew) self.toolBar.addAction(self.actionOpen) self.toolBar.addSeparator() self.toolBar.addAction(self.actionSave) self.toolBar.addAction(self.actionSave_as) self.toolBar.addSeparator() self.toolBar.addAction(self.actionConfigure_run) self.toolBar.addAction(self.actionRun) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)