Example #1
0
 def _load_editor_plugins(self):
     """
     Loads editor plugins.
     """
     _logger().info('loading editor plugins')
     entrypoints = list(
         pkg_resources.iter_entry_points(plugins.EditorPlugin.ENTRYPOINT))
     for entrypoint in entrypoints:
         _logger().info('  - loading plugin: %s', entrypoint)
         try:
             plugin_class = entrypoint.load()
         except Exception as e:
             _logger().exception('Failed to load editor plugin')
             name = str(entrypoint).split('=')[0].strip()
             self.failed_to_load[name] = traceback.format_exc(), e
         else:
             try:
                 klass = plugin_class.get_editor_class()
             except AttributeError as e:
                 _logger().exception(
                     'invalid editor plugin: register_editor not '
                     'implemented')
                 self.failed_to_load[name] = traceback.format_exc(), e
             else:
                 SplittableCodeEditTabWidget.register_code_edit(klass)
                 self.editor_plugins.append(plugin_class)
Example #2
0
 def _load_editor_plugins(self):
     """
     Loads editor plugins.
     """
     _logger().info('loading editor plugins')
     entrypoints = list(pkg_resources.iter_entry_points(
         plugins.EditorPlugin.ENTRYPOINT))
     for entrypoint in entrypoints:
         _logger().info('  - loading plugin: %s', entrypoint)
         try:
             plugin_class = entrypoint.load()
         except Exception as e:
             _logger().exception('Failed to load editor plugin')
             name = str(entrypoint).split('=')[0].strip()
             self.failed_to_load[name] = traceback.format_exc(), e
         else:
             try:
                 klass = plugin_class.get_editor_class()
             except AttributeError as e:
                 _logger().exception(
                     'invalid editor plugin: register_editor not '
                     'implemented')
                 self.failed_to_load[name] = traceback.format_exc(), e
             else:
                 SplittableCodeEditTabWidget.register_code_edit(klass)
                 self.editor_plugins.append(plugin_class)
Example #3
0
    def event_startup(self):

        # Loop through all code edit classes that are bundles with the
        # extension and register them if they're enabled in the configuration.
        for key in dir(lsp_code_edit_widgets):
            cls = getattr(lsp_code_edit_widgets, key)
            # Check if it's a code edit class
            if not isinstance(cls, type) or not issubclass(cls, CodeEdit):
                continue
            # Check if the language server is configured and enabled
            try:
                enabled = cfg['lsp_enable_{}'.format(cls.language.lower())]
            except BaseException:
                oslogger.warning(
                    '{} language server is missing in config'.format(
                        cls.language))
                continue
            if not enabled:
                oslogger.debug(
                    '{} language server is disabled in config'.format(
                        cls.language))
                continue
            oslogger.debug('{} language server enabled'.format(cls.language))
            cls.extension_manager = self.extension_manager
            SplittableCodeEditTabWidget.register_code_edit(cls)
Example #4
0
    def __init__(self, name, experiment, string=None):

        # This requires pyqode_extras, which is not available in opensesamerun
        # and therefore we import it only here.
        from javascript_code_edit import JavaScriptCodeEdit
        
        if self.mime_type not in SplittableCodeEditTabWidget.editors:
            SplittableCodeEditTabWidget.register_code_edit(JavaScriptCodeEdit)
        inline_script.__init__(self, name, experiment, string)
        qtplugin.__init__(self, plugin_file=__file__)
Example #5
0
class MainUI(object):
    def setupUi(self, MainWindow):
        """ setupUi(QMainWindow MainWindow)
        
            -Creates all the ui components for MainWindow.
            -MainWindow will be the object that Inherits this class.
        """
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1000, 700)
        # icon = QtGui.QIcon()
        # icon.addPixmap(QtGui.QPixmap(":/icons/pyqode.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        # MainWindow.setWindowIcon(icon)
        
        # central widget
        self.centralwidget = FileDropWidget(MainWindow)  
        self.centralwidget.setObjectName("centralwidget")
        
        # main layout
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setHorizontalSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        
        # Splittable Tabs
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1)
        
        MainWindow.setCentralWidget(self.centralwidget)
        
        # menubar
        # self.menubar = QtWidgets.QMenuBar(MainWindow)
        # self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 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)
        
        # statusbar
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
Example #6
0
class MainUI(object):
    def setupUi(self, MainWindow):
        """ setupUi(QMainWindow MainWindow)
        
            -Creates all the ui components for MainWindow.
            -MainWindow will be the object that Inherits this class.
        """
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1000, 700)
        # icon = QtGui.QIcon()
        # icon.addPixmap(QtGui.QPixmap(":/icons/pyqode.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        # MainWindow.setWindowIcon(icon)

        # central widget
        self.centralwidget = FileDropWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        # main layout
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setHorizontalSpacing(0)
        self.gridLayout.setObjectName("gridLayout")

        # Splittable Tabs
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1)

        MainWindow.setCentralWidget(self.centralwidget)

        # menubar
        # self.menubar = QtWidgets.QMenuBar(MainWindow)
        # self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 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)

        # statusbar
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(778, 575)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/hackedit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        MainWindow.setDockOptions(QtWidgets.QMainWindow.AnimatedDocks)
        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.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
        self.stackedWidget.setObjectName("stackedWidget")
        self.page_edit = QtWidgets.QWidget()
        self.page_edit.setObjectName("page_edit")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.page_edit)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabs = SplittableCodeEditTabWidget(self.page_edit)
        self.tabs.setObjectName("tabs")
        self.verticalLayout.addWidget(self.tabs)
        self.stackedWidget.addWidget(self.page_edit)
        self.page_empty = QtWidgets.QWidget()
        self.page_empty.setObjectName("page_empty")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.page_empty)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        spacerItem = QtWidgets.QSpacerItem(20, 171, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem, 0, 1, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(193, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem1, 1, 0, 1, 1)
        spacerItem2 = QtWidgets.QSpacerItem(192, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem2, 1, 2, 1, 1)
        self.label = QtWidgets.QLabel(self.page_empty)
        self.label.setObjectName("label")
        self.gridLayout_2.addWidget(self.label, 1, 1, 1, 1)
        spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem3, 2, 1, 1, 1)
        self.stackedWidget.addWidget(self.page_empty)
        self.gridLayout.addWidget(self.stackedWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 778, 27))
        self.menubar.setObjectName("menubar")
        self.mnu_file = QtWidgets.QMenu(self.menubar)
        self.mnu_file.setObjectName("mnu_file")
        self.mnu_view = QtWidgets.QMenu(self.menubar)
        self.mnu_view.setObjectName("mnu_view")
        self.mnu_windows = QtWidgets.QMenu(self.mnu_view)
        self.mnu_windows.setObjectName("mnu_windows")
        self.mnu_help = QtWidgets.QMenu(self.menubar)
        self.mnu_help.setObjectName("mnu_help")
        self.mnu_edit = QtWidgets.QMenu(self.menubar)
        self.mnu_edit.setObjectName("mnu_edit")
        self.menuActive_editor = QtWidgets.QMenu(self.mnu_edit)
        icon = QtGui.QIcon.fromTheme("accessories-text-editor")
        self.menuActive_editor.setIcon(icon)
        self.menuActive_editor.setObjectName("menuActive_editor")
        self.menuTools = QtWidgets.QMenu(self.menubar)
        self.menuTools.setObjectName("menuTools")
        MainWindow.setMenuBar(self.menubar)
        self.toolBarFile = QtWidgets.QToolBar(MainWindow)
        self.toolBarFile.setObjectName("toolBarFile")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarFile)
        self.action_open = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("folder")
        self.action_open.setIcon(icon)
        self.action_open.setShortcutContext(QtCore.Qt.WindowShortcut)
        self.action_open.setObjectName("action_open")
        self.action_save = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save")
        self.action_save.setIcon(icon)
        self.action_save.setObjectName("action_save")
        self.action_save_as = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save-as")
        self.action_save_as.setIcon(icon)
        self.action_save_as.setObjectName("action_save_as")
        self.action_close = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("window-close")
        self.action_close.setIcon(icon)
        self.action_close.setObjectName("action_close")
        self.action_quit = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("application-exit")
        self.action_quit.setIcon(icon)
        self.action_quit.setObjectName("action_quit")
        self.action_preferences = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("preferences-system")
        self.action_preferences.setIcon(icon)
        self.action_preferences.setObjectName("action_preferences")
        self.action_about = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("help-about")
        self.action_about.setIcon(icon)
        self.action_about.setObjectName("action_about")
        self.action_help = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("system-help")
        self.action_help.setIcon(icon)
        self.action_help.setObjectName("action_help")
        self.action_new = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-new")
        self.action_new.setIcon(icon)
        self.action_new.setObjectName("action_new")
        self.action_report_bug = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("tools-report-bug")
        self.action_report_bug.setIcon(icon)
        self.action_report_bug.setObjectName("action_report_bug")
        self.action_save_all = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save-all")
        self.action_save_all.setIcon(icon)
        self.action_save_all.setObjectName("action_save_all")
        self.action_check_for_update = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("system-software-update")
        self.action_check_for_update.setIcon(icon)
        self.action_check_for_update.setObjectName("action_check_for_update")
        self.a_fullscreen = QtWidgets.QAction(MainWindow)
        self.a_fullscreen.setCheckable(True)
        self.a_fullscreen.setChecked(False)
        icon = QtGui.QIcon.fromTheme("view-fullscreen")
        self.a_fullscreen.setIcon(icon)
        self.a_fullscreen.setObjectName("a_fullscreen")
        self.a_menu = QtWidgets.QAction(MainWindow)
        self.a_menu.setCheckable(True)
        self.a_menu.setChecked(False)
        self.a_menu.setObjectName("a_menu")
        self.action_open_file = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-open")
        self.action_open_file.setIcon(icon)
        self.action_open_file.setObjectName("action_open_file")
        self.a_print = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-print")
        self.a_print.setIcon(icon)
        self.a_print.setObjectName("a_print")
        self.mnu_file.addAction(self.action_new)
        self.mnu_file.addAction(self.action_open_file)
        self.mnu_file.addAction(self.action_open)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_save)
        self.mnu_file.addAction(self.action_save_as)
        self.mnu_file.addAction(self.action_save_all)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.a_print)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_close)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_quit)
        self.mnu_view.addAction(self.a_fullscreen)
        self.mnu_view.addAction(self.a_menu)
        self.mnu_view.addSeparator()
        self.mnu_view.addAction(self.mnu_windows.menuAction())
        self.mnu_help.addAction(self.action_help)
        self.mnu_help.addAction(self.action_about)
        self.mnu_help.addSeparator()
        self.mnu_help.addAction(self.action_report_bug)
        self.mnu_help.addSeparator()
        self.mnu_help.addAction(self.action_check_for_update)
        self.mnu_edit.addAction(self.menuActive_editor.menuAction())
        self.mnu_edit.addSeparator()
        self.mnu_edit.addAction(self.action_preferences)
        self.menubar.addAction(self.mnu_file.menuAction())
        self.menubar.addAction(self.mnu_edit.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.mnu_view.menuAction())
        self.menubar.addAction(self.mnu_help.menuAction())
        self.toolBarFile.addAction(self.action_new)
        self.toolBarFile.addAction(self.action_open_file)
        self.toolBarFile.addAction(self.action_open)
        self.toolBarFile.addSeparator()
        self.toolBarFile.addAction(self.action_save)
        self.toolBarFile.addAction(self.action_save_as)

        self.retranslateUi(MainWindow)
        self.stackedWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(778, 575)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/hackedit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        MainWindow.setDockOptions(QtWidgets.QMainWindow.AnimatedDocks)
        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.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
        self.stackedWidget.setObjectName("stackedWidget")
        self.page_edit = QtWidgets.QWidget()
        self.page_edit.setObjectName("page_edit")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.page_edit)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tabs = SplittableCodeEditTabWidget(self.page_edit)
        self.tabs.setObjectName("tabs")
        self.verticalLayout.addWidget(self.tabs)
        self.stackedWidget.addWidget(self.page_edit)
        self.page_empty = QtWidgets.QWidget()
        self.page_empty.setObjectName("page_empty")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.page_empty)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        spacerItem = QtWidgets.QSpacerItem(20, 171, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem, 0, 1, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(193, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem1, 1, 0, 1, 1)
        spacerItem2 = QtWidgets.QSpacerItem(192, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_2.addItem(spacerItem2, 1, 2, 1, 1)
        self.label = QtWidgets.QLabel(self.page_empty)
        self.label.setObjectName("label")
        self.gridLayout_2.addWidget(self.label, 1, 1, 1, 1)
        spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem3, 2, 1, 1, 1)
        self.stackedWidget.addWidget(self.page_empty)
        self.gridLayout.addWidget(self.stackedWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 778, 27))
        self.menubar.setObjectName("menubar")
        self.mnu_file = QtWidgets.QMenu(self.menubar)
        self.mnu_file.setObjectName("mnu_file")
        self.mnu_view = QtWidgets.QMenu(self.menubar)
        self.mnu_view.setObjectName("mnu_view")
        self.mnu_windows = QtWidgets.QMenu(self.mnu_view)
        self.mnu_windows.setObjectName("mnu_windows")
        self.mnu_help = QtWidgets.QMenu(self.menubar)
        self.mnu_help.setObjectName("mnu_help")
        self.mnu_edit = QtWidgets.QMenu(self.menubar)
        self.mnu_edit.setObjectName("mnu_edit")
        self.menuActive_editor = QtWidgets.QMenu(self.mnu_edit)
        icon = QtGui.QIcon.fromTheme("accessories-text-editor")
        self.menuActive_editor.setIcon(icon)
        self.menuActive_editor.setObjectName("menuActive_editor")
        self.menuTools = QtWidgets.QMenu(self.menubar)
        self.menuTools.setObjectName("menuTools")
        MainWindow.setMenuBar(self.menubar)
        self.toolBarFile = QtWidgets.QToolBar(MainWindow)
        self.toolBarFile.setObjectName("toolBarFile")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBarFile)
        self.action_open = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("folder")
        self.action_open.setIcon(icon)
        self.action_open.setShortcutContext(QtCore.Qt.WindowShortcut)
        self.action_open.setObjectName("action_open")
        self.action_save = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save")
        self.action_save.setIcon(icon)
        self.action_save.setObjectName("action_save")
        self.action_save_as = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save-as")
        self.action_save_as.setIcon(icon)
        self.action_save_as.setObjectName("action_save_as")
        self.action_close = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("window-close")
        self.action_close.setIcon(icon)
        self.action_close.setObjectName("action_close")
        self.action_quit = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("application-exit")
        self.action_quit.setIcon(icon)
        self.action_quit.setObjectName("action_quit")
        self.action_preferences = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("preferences-system")
        self.action_preferences.setIcon(icon)
        self.action_preferences.setObjectName("action_preferences")
        self.action_about = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("help-about")
        self.action_about.setIcon(icon)
        self.action_about.setObjectName("action_about")
        self.action_help = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("system-help")
        self.action_help.setIcon(icon)
        self.action_help.setObjectName("action_help")
        self.action_new = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-new")
        self.action_new.setIcon(icon)
        self.action_new.setObjectName("action_new")
        self.action_report_bug = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("tools-report-bug")
        self.action_report_bug.setIcon(icon)
        self.action_report_bug.setObjectName("action_report_bug")
        self.action_save_all = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-save-all")
        self.action_save_all.setIcon(icon)
        self.action_save_all.setObjectName("action_save_all")
        self.action_check_for_update = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("system-software-update")
        self.action_check_for_update.setIcon(icon)
        self.action_check_for_update.setObjectName("action_check_for_update")
        self.a_fullscreen = QtWidgets.QAction(MainWindow)
        self.a_fullscreen.setCheckable(True)
        self.a_fullscreen.setChecked(False)
        icon = QtGui.QIcon.fromTheme("view-fullscreen")
        self.a_fullscreen.setIcon(icon)
        self.a_fullscreen.setObjectName("a_fullscreen")
        self.a_menu = QtWidgets.QAction(MainWindow)
        self.a_menu.setCheckable(True)
        self.a_menu.setChecked(False)
        self.a_menu.setObjectName("a_menu")
        self.action_open_file = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-open")
        self.action_open_file.setIcon(icon)
        self.action_open_file.setObjectName("action_open_file")
        self.a_print = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon.fromTheme("document-print")
        self.a_print.setIcon(icon)
        self.a_print.setObjectName("a_print")
        self.mnu_file.addAction(self.action_new)
        self.mnu_file.addAction(self.action_open_file)
        self.mnu_file.addAction(self.action_open)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_save)
        self.mnu_file.addAction(self.action_save_as)
        self.mnu_file.addAction(self.action_save_all)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.a_print)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_close)
        self.mnu_file.addSeparator()
        self.mnu_file.addAction(self.action_quit)
        self.mnu_view.addAction(self.a_fullscreen)
        self.mnu_view.addAction(self.a_menu)
        self.mnu_view.addSeparator()
        self.mnu_view.addAction(self.mnu_windows.menuAction())
        self.mnu_help.addAction(self.action_help)
        self.mnu_help.addAction(self.action_about)
        self.mnu_help.addSeparator()
        self.mnu_help.addAction(self.action_report_bug)
        self.mnu_help.addSeparator()
        self.mnu_help.addAction(self.action_check_for_update)
        self.mnu_edit.addAction(self.menuActive_editor.menuAction())
        self.mnu_edit.addSeparator()
        self.mnu_edit.addAction(self.action_preferences)
        self.menubar.addAction(self.mnu_file.menuAction())
        self.menubar.addAction(self.mnu_edit.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.mnu_view.menuAction())
        self.menubar.addAction(self.mnu_help.menuAction())
        self.toolBarFile.addAction(self.action_new)
        self.toolBarFile.addAction(self.action_open_file)
        self.toolBarFile.addAction(self.action_open)
        self.toolBarFile.addSeparator()
        self.toolBarFile.addAction(self.action_save)
        self.toolBarFile.addAction(self.action_save_as)

        self.retranslateUi(MainWindow)
        self.stackedWidget.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "HackEdit"))
        self.label.setText(_translate("MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:18pt;\">Open a document</span></p><hr/><ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li style=\" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">File &gt; Open File</span> (<span style=\" font-style:italic;\">Ctrl+O</span>)</li><li style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">Goto &gt; Goto anything</span> (<span style=\" font-style:italic;\">Ctrl+P</span>) and type to open file from any open project</li><li style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Use the project tree view</li></ul><ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Drag and drop files here</li></ul></body></html>"))
        self.mnu_file.setTitle(_translate("MainWindow", "Fi&le"))
        self.mnu_view.setTitle(_translate("MainWindow", "&View"))
        self.mnu_windows.setToolTip(_translate("MainWindow", "The list of windows"))
        self.mnu_windows.setTitle(_translate("MainWindow", "&Windows"))
        self.mnu_help.setTitle(_translate("MainWindow", "?"))
        self.mnu_edit.setTitle(_translate("MainWindow", "E&dit"))
        self.menuActive_editor.setToolTip(_translate("MainWindow", "Active editor actions"))
        self.menuActive_editor.setTitle(_translate("MainWindow", "&Active editor"))
        self.menuTools.setTitle(_translate("MainWindow", "&Tools"))
        self.toolBarFile.setWindowTitle(_translate("MainWindow", "FileToolBar"))
        self.action_open.setText(_translate("MainWindow", "&Open project"))
        self.action_open.setToolTip(_translate("MainWindow", "Open a project"))
        self.action_open.setShortcut(_translate("MainWindow", "Ctrl+O"))
        self.action_save.setText(_translate("MainWindow", "&Save"))
        self.action_save.setToolTip(_translate("MainWindow", "Save current editor"))
        self.action_save.setShortcut(_translate("MainWindow", "Ctrl+S"))
        self.action_save_as.setText(_translate("MainWindow", "Sa&ve as"))
        self.action_save_as.setToolTip(_translate("MainWindow", "Save current editor as"))
        self.action_save_as.setShortcut(_translate("MainWindow", "Ctrl+Alt+S"))
        self.action_close.setText(_translate("MainWindow", "&Close window"))
        self.action_close.setShortcut(_translate("MainWindow", "Ctrl+Shift+Q"))
        self.action_quit.setText(_translate("MainWindow", "&Quit"))
        self.action_quit.setToolTip(_translate("MainWindow", "Quit application"))
        self.action_quit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
        self.action_preferences.setText(_translate("MainWindow", "&Preferences"))
        self.action_preferences.setToolTip(_translate("MainWindow", "Edit preferences"))
        self.action_preferences.setShortcut(_translate("MainWindow", "Ctrl+,"))
        self.action_about.setText(_translate("MainWindow", "&About"))
        self.action_about.setToolTip(_translate("MainWindow", "About HackEdit"))
        self.action_help.setText(_translate("MainWindow", "&Help"))
        self.action_help.setToolTip(_translate("MainWindow", "Get some help"))
        self.action_new.setText(_translate("MainWindow", "&New"))
        self.action_new.setToolTip(_translate("MainWindow", "Create a new file/project"))
        self.action_new.setShortcut(_translate("MainWindow", "Ctrl+N"))
        self.action_report_bug.setText(_translate("MainWindow", "&Report an issue..."))
        self.action_report_bug.setToolTip(_translate("MainWindow", "Create an issue (report a bug/enhancement)"))
        self.action_save_all.setText(_translate("MainWindow", "Save a&ll"))
        self.action_save_all.setToolTip(_translate("MainWindow", "Save all editors"))
        self.action_save_all.setShortcut(_translate("MainWindow", "Ctrl+Shift+S"))
        self.action_check_for_update.setText(_translate("MainWindow", "&Check for update"))
        self.a_fullscreen.setText(_translate("MainWindow", "&Toggle fullscreen"))
        self.a_fullscreen.setToolTip(_translate("MainWindow", "Toggle fullscreen"))
        self.a_menu.setText(_translate("MainWindow", "Toggle &menu"))
        self.a_menu.setToolTip(_translate("MainWindow", "Show/Hide menu bar"))
        self.action_open_file.setText(_translate("MainWindow", "Open &file"))
        self.action_open_file.setToolTip(_translate("MainWindow", "Open a file"))
        self.a_print.setText(_translate("MainWindow", "&Print"))
Example #9
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        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.setObjectName("gridLayout")
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setOrientation(QtCore.Qt.Horizontal)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        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.treeView = FileSystemTreeView(self.dockWidgetContents)
        self.treeView.setObjectName("treeView")
        self.gridLayout_2.addWidget(self.treeView, 0, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
        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.actionClose_tab = QtWidgets.QAction(MainWindow)
        self.actionClose_tab.setIconVisibleInMenu(True)
        self.actionClose_tab.setObjectName("actionClose_tab")
        self.actionClose_other_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_other_tabs.setIconVisibleInMenu(True)
        self.actionClose_other_tabs.setObjectName("actionClose_other_tabs")
        self.actionClose_all_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_all_tabs.setIconVisibleInMenu(True)
        self.actionClose_all_tabs.setObjectName("actionClose_all_tabs")
        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.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        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.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #10
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        self.setWindowTitle("PyCreator")
        self.setObjectName("MainWindow")
        self.resize(1000, 700)

        # filedropwidget allows file drops on main window
        self.centralwidget = FileDropWidget(self)
        self.centralwidget.setObjectName("centralwidget")

        # main layout
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setHorizontalSpacing(0)
        self.gridLayout.setObjectName("gridLayout")

        # Splittable Tabs
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1)

        self.setCentralWidget(self.centralwidget)

        # statusbar
        self.statusbar = QtWidgets.QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        # tabWidget
        self.tabWidget.register_code_edit(PythonEditor)
        self.tabWidget.register_code_edit(TextCodeEdit)
        self.tabWidget.current_changed.connect(self.on_current_tab_changed)
        self.tabWidget.last_tab_closed.connect(self.on_last_tab_closed)

        # Output Dock
        self.outputDock = OutputDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.outputDock)
        self.outputDock.iconsole.open_file_requested.connect(self.open_file)
        self.outputDock.iconsole.process_finished.connect(
            self.on_process_finished)

        # File Browser Dock
        self.fileBrowser = FileBrowserDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.fileBrowser)
        self.fileBrowser.fileOpenRequest.connect(self.open_file)
        self.fileBrowser.pylint_finished.connect(self.pylintFinished)

        # Outline Dock
        self.outlineTreeDock = OutlineDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.outlineTreeDock)

        # Handle file drops on main widget
        self.centralwidget.fileDropped.connect(self.onFileDropped)

        self.recent_files_manager = widgets.RecentFilesManager(
             'Zach Moore', 'PyCreator')

        # menuBar setup
        self.menuBar = MainMenuBar(self)
        self.setMenuBar(self.menuBar)
        # menu connections
        self.menuBar.newAct.triggered.connect(self.on_new)
        self.menuBar.openAct.triggered.connect(self.on_open)
        self.menuBar.openRecMenu.open_requested.connect(self.open_file)
        self.menuBar.closeAllAct.triggered.connect(
            self.tabWidget.main_tab_widget.close_all)
        self.menuBar.saveAct.triggered.connect(self.on_save)
        self.menuBar.saveAsAct.triggered.connect(self.on_save_as)
        self.menuBar.saveAllAct.triggered.connect(self.on_save_all)
        self.menuBar.exitAct.triggered.connect(
            QtWidgets.QApplication.instance().quit)
        self.menuBar.runConfigAct.triggered.connect(self.on_configure_run)
        self.menuBar.runAct.triggered.connect(self.on_run)
        self.menuBar.interpAct.triggered.connect(self.onInterpConfig)

        self.setup_status_bar_widgets()
        self.on_current_tab_changed()

        # add docks to view menu
        self.menuBar.addDock(self.outlineTreeDock)
        self.menuBar.addDock(self.outputDock)
        self.menuBar.addDock(self.fileBrowser)

        # toolbars
        self.fileBar = QtWidgets.QToolBar(self)
        self.fileBar.setObjectName("filebar")
        ToolBars.initFileBar(self.fileBar, self.menuBar)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.fileBar)
        self.toolsBar = QtWidgets.QToolBar(self)
        self.toolsBar.setObjectName("toolsbar")
        ToolBars.initToolsBar(self.toolsBar, self.menuBar)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolsBar)
        self.editBar = QtWidgets.QToolBar(self)
        self.editBar.setObjectName("editbar")
        ToolBars.initEditBar(self.editBar, self.tabWidget.current_widget())
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.editBar)

        self.restoreWinState()
        # must update view menu to get correct states
        self.menuBar.updateViewMenu()
Example #11
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        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.setObjectName("gridLayout")
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setOrientation(QtCore.Qt.Horizontal)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        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.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.actionClose_tab = QtWidgets.QAction(MainWindow)
        self.actionClose_tab.setIconVisibleInMenu(True)
        self.actionClose_tab.setObjectName("actionClose_tab")
        self.actionClose_other_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_other_tabs.setIconVisibleInMenu(True)
        self.actionClose_other_tabs.setObjectName("actionClose_other_tabs")
        self.actionClose_all_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_all_tabs.setIconVisibleInMenu(True)
        self.actionClose_all_tabs.setObjectName("actionClose_all_tabs")
        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.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        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.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "notepad"))
        self.menuFile.setTitle(_translate("MainWindow", "File"))
        self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
        self.menuModes.setTitle(_translate("MainWindow", "Modes"))
        self.menuPanels.setTitle(_translate("MainWindow", "Panels"))
        self.menu.setTitle(_translate("MainWindow", "?"))
        self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
        self.actionNew.setText(_translate("MainWindow", "New"))
        self.actionNew.setShortcut(_translate("MainWindow", "Ctrl+N"))
        self.actionOpen.setText(_translate("MainWindow", "Open"))
        self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))
        self.actionSave.setText(_translate("MainWindow", "Save"))
        self.actionSave.setShortcut(_translate("MainWindow", "Ctrl+S"))
        self.actionSave_as.setText(_translate("MainWindow", "Save as"))
        self.actionSave_as.setShortcut(_translate("MainWindow", "Ctrl+Shift+S"))
        self.actionClose_tab.setText(_translate("MainWindow", "Close tab"))
        self.actionClose_other_tabs.setText(_translate("MainWindow", "Close other tabs"))
        self.actionClose_all_tabs.setText(_translate("MainWindow", "Close all tabs"))
        self.actionQuit.setText(_translate("MainWindow", "Quit"))
        self.actionQuit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
        self.actionAbout.setText(_translate("MainWindow", "About"))
        self.actionAbout.setShortcut(_translate("MainWindow", "F1"))
Example #12
0
    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)
Example #13
0
    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)
    def __init__(self, name, experiment, string=None):

        if self.mime_type not in SplittableCodeEditTabWidget.editors:
            SplittableCodeEditTabWidget.register_code_edit(JavaScriptCodeEdit)
        inline_script.__init__(self, name, experiment, string)
        qtplugin.__init__(self, plugin_file=__file__)
    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)
Example #16
0
import os
import sys
from pyqode.qt import QtWidgets
from pyqode.core.widgets import SplittableCodeEditTabWidget


def open_in_explorer():
    print('open %r in explorer' %
          SplittableCodeEditTabWidget.tab_under_menu.file.path)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    tab_widget = SplittableCodeEditTabWidget()
    action = QtWidgets.QAction('Open in explorer', tab_widget)
    action.triggered.connect(open_in_explorer)
    tab_widget.add_context_action(action)
    tab_widget.setMinimumSize(800, 600)
    tab_widget.open_document(
        os.path.join(os.getcwd(), 'test_dir', 'readme.txt'))
    tab_widget.open_document(
        os.path.join(os.getcwd(), 'test_dir', 'subdir', 'readme.txt'))
    tab_widget.create_new_document('My New Document', '.pyw')
    tab_widget.create_new_document('My New Document', '.pyw')
    tab_widget.show()
    app.exec_()
Example #17
0
class MainWindow(QtWidgets.QMainWindow, MainUI):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        self.setWindowTitle("PyCreator")
        self.setObjectName("MainWindow")
        self.resize(1000, 700)

        # filedropwidget allows file drops on main window
        self.centralwidget = FileDropWidget(self)
        self.centralwidget.setObjectName("centralwidget")

        # main layout
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setHorizontalSpacing(0)
        self.gridLayout.setObjectName("gridLayout")

        # Splittable Tabs
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 1, 0, 1, 1)

        self.setCentralWidget(self.centralwidget)

        # statusbar
        self.statusbar = QtWidgets.QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        # tabWidget
        self.tabWidget.register_code_edit(PythonEditor)
        self.tabWidget.register_code_edit(TextCodeEdit)
        self.tabWidget.current_changed.connect(self.on_current_tab_changed)
        self.tabWidget.last_tab_closed.connect(self.on_last_tab_closed)

        # Output Dock
        self.outputDock = OutputDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.outputDock)
        self.outputDock.iconsole.open_file_requested.connect(self.open_file)
        self.outputDock.iconsole.process_finished.connect(
            self.on_process_finished)

        # File Browser Dock
        self.fileBrowser = FileBrowserDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.fileBrowser)
        self.fileBrowser.fileOpenRequest.connect(self.open_file)
        self.fileBrowser.pylint_finished.connect(self.pylintFinished)

        # Outline Dock
        self.outlineTreeDock = OutlineDock()
        self.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.outlineTreeDock)

        # Handle file drops on main widget
        self.centralwidget.fileDropped.connect(self.onFileDropped)

        self.recent_files_manager = widgets.RecentFilesManager(
             'Zach Moore', 'PyCreator')

        # menuBar setup
        self.menuBar = MainMenuBar(self)
        self.setMenuBar(self.menuBar)
        # menu connections
        self.menuBar.newAct.triggered.connect(self.on_new)
        self.menuBar.openAct.triggered.connect(self.on_open)
        self.menuBar.openRecMenu.open_requested.connect(self.open_file)
        self.menuBar.closeAllAct.triggered.connect(
            self.tabWidget.main_tab_widget.close_all)
        self.menuBar.saveAct.triggered.connect(self.on_save)
        self.menuBar.saveAsAct.triggered.connect(self.on_save_as)
        self.menuBar.saveAllAct.triggered.connect(self.on_save_all)
        self.menuBar.exitAct.triggered.connect(
            QtWidgets.QApplication.instance().quit)
        self.menuBar.runConfigAct.triggered.connect(self.on_configure_run)
        self.menuBar.runAct.triggered.connect(self.on_run)
        self.menuBar.interpAct.triggered.connect(self.onInterpConfig)

        self.setup_status_bar_widgets()
        self.on_current_tab_changed()

        # add docks to view menu
        self.menuBar.addDock(self.outlineTreeDock)
        self.menuBar.addDock(self.outputDock)
        self.menuBar.addDock(self.fileBrowser)

        # toolbars
        self.fileBar = QtWidgets.QToolBar(self)
        self.fileBar.setObjectName("filebar")
        ToolBars.initFileBar(self.fileBar, self.menuBar)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.fileBar)
        self.toolsBar = QtWidgets.QToolBar(self)
        self.toolsBar.setObjectName("toolsbar")
        ToolBars.initToolsBar(self.toolsBar, self.menuBar)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.toolsBar)
        self.editBar = QtWidgets.QToolBar(self)
        self.editBar.setObjectName("editbar")
        ToolBars.initEditBar(self.editBar, self.tabWidget.current_widget())
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.editBar)

        self.restoreWinState()
        # must update view menu to get correct states
        self.menuBar.updateViewMenu()

    def restoreWinState(self):
        state = Settings().mainWindowState
        self.restoreState(state[Settings.MWState])
        self.resize(state[Settings.MWSize])
        self.move(state[Settings.MWPosition])
        if state[Settings.MWMaximized]:
            self.showMaximized()

    def setup_status_bar_widgets(self):
        self.lbl_interpreter = QtWidgets.QLabel()
        self.lbl_filename = QtWidgets.QLabel()
        self.lbl_encoding = QtWidgets.QLabel()
        self.lbl_cursor_pos = QtWidgets.QLabel()
        self.statusbar.addPermanentWidget(self.lbl_filename, 200)
        self.statusbar.addPermanentWidget(self.lbl_interpreter, 100)
        self.statusbar.addPermanentWidget(self.lbl_encoding, 20)
        self.statusbar.addPermanentWidget(self.lbl_cursor_pos, 20)

    def closeEvent(self, QCloseEvent):
        """
        Delegates the close event to the tabWidget to be sure we do not quit
        the application while there are some still some unsaved tabs.
        """
        self.tabWidget.closeEvent(QCloseEvent)
        # Save window state
        state = [self.saveState(),
                 self.size(),
                 self.pos(),
                 self.isMaximized()]
        Settings().mainWindowState = state

    def setup_editor(self, editor):
        """
        Setup the python editor, run the server and connect a few signals.

        :param editor: editor to setup.
        """
        editor.cursorPositionChanged.connect(self.on_cursor_pos_changed)
        try:
            m = editor.modes.get(modes.GoToAssignmentsMode)
        except KeyError:
            pass
        else:
            assert isinstance(m, modes.GoToAssignmentsMode)
            m.out_of_doc.connect(self.on_goto_out_of_doc)

    def open_file(self, path, line=None):
        """
        Creates a new GenericCodeEdit, opens the requested file and adds it
        to the tab widget.

        :param path: Path of the file to open

        :return The opened editor if open succeeded.
        """
        editor = None
        if path:
            editor = self.tabWidget.open_document(
                path, interpreter=utils.getInterpreter())
            if editor:
                self.setup_editor(editor)
            self.recent_files_manager.open_file(path)
            self.menuBar.openRecMenu.update_actions()
        if line is not None:
            TextHelper(self.tabWidget.current_widget()).goto_line(line)
        return editor

    @QtCore.Slot()
    def onInterpConfig(self):
        if InterpreterConfigDialog.run(self):
            for editor in self.tabWidget.widgets(include_clones=True):
                editor.backend.stop()
                editor.backend.start(editor.backend.server_script,
                                     interpreter=utils.getInterpreter(),
                                     args=editor.backend.args)

    @QtCore.Slot()
    def on_new(self):
        """
        Add a new empty code editor to the tab widget
        """
        self.setup_editor(self.tabWidget.create_new_document(
            extension='.py', interpreter=utils.getInterpreter()))
        self.menuBar.runAct.setDisabled(True)
        self.menuBar.runConfigAct.setDisabled(True)

    @QtCore.Slot()
    def on_open(self):
        """
        Shows an open file dialog and open the file if the dialog was
        accepted.

        """
        filename, filter = QtWidgets.QFileDialog.getOpenFileName(self, 'Open')
        if filename:
            self.open_file(filename)
        self.menuBar.runAct.setEnabled(True)
        self.menuBar.runConfigAct.setEnabled(True)

    @QtCore.Slot()
    def on_save(self):
        self.tabWidget.save_current()
        self._enable_run()
        self._update_status_bar(self.tabWidget.current_widget())

    @QtCore.Slot()
    def on_save_as(self):
        """
        Save the current editor document as.
        """
        path = self.tabWidget.current_widget().file.path
        path = os.path.dirname(path) if path else ''
        filename, filter = QtWidgets.QFileDialog.getSaveFileName(
            self, 'Save', path)
        if filename:
            self.tabWidget.save_current(filename)
            self.recent_files_manager.open_file(filename)
            self.menuBar.openRecMenu.update_actions()
            self.menuBar.runAct.setEnabled(True)
            self.menuBar.runConfigAct.setEnabled(True)
            self._update_status_bar(self.tabWidget.current_widget())

    @QtCore.Slot()
    def on_save_all(self):
        self.tabWidget.save_all()
        self._update_status_bar(self.tabWidget.current_widget())

    @QtCore.Slot(str)
    def onFileDropped(self, path):
        p = utils.rectifyPath(path)
        self.open_file(p)

    def setup_mnu_edit(self, editor):
        """
        Setup the edit menu for the current editor. We show the current editor
        context menu and a menu to change the python interpreter.
    
        :param editor: new editor
        """
        self.menuBar.editMenu.addActions(editor.actions())

    @QtCore.Slot()
    def on_last_tab_closed(self):
        self.outlineTreeDock.outlineTree.set_editor(None)
        self.menuBar.editMenu.setEnabled(False)
        self.menuBar.saveAct.setEnabled(False)
        self.menuBar.saveAsAct.setEnabled(False)
        self.menuBar.saveAllAct.setEnabled(False)
        self.menuBar.runAct.setEnabled(False)
        self.menuBar.runConfigAct.setEnabled(False)

    @QtCore.Slot()
    def on_current_tab_changed(self):
        """
        Update action states when the current tab changed.
        """
        self.menuBar.editMenu.clear()
        # self.menuModes.clear()
        # self.menuPanels.clear()
        editor = self.tabWidget.current_widget()
        self.menuBar.editMenu.setEnabled(editor is not None)
        # self.menuModes.setEnabled(editor is not None)
        # self.menuPanels.setEnabled(editor is not None)
        self.menuBar.saveAct.setEnabled(editor is not None)
        self.menuBar.saveAsAct.setEnabled(editor is not None)
        self.menuBar.saveAllAct.setEnabled(editor is not None)
        self.menuBar.runAct.setEnabled(editor is not None)
        self.menuBar.runConfigAct.setEnabled(editor is not None)
        if editor is not None:
            self.setup_mnu_edit(editor)
            ToolBars.initEditBar(self.editBar, editor)
            # self.setup_mnu_modes(editor)
            # self.setup_mnu_panels(editor)
        self.outlineTreeDock.outlineTree.set_editor(editor)
        self._update_status_bar(editor)

    def _update_status_bar(self, editor):
        if editor:
            l, c = TextHelper(editor).cursor_position()
            self.lbl_cursor_pos.setText(
                '%d:%d' % (l + 1, c + 1))
            self.lbl_encoding.setText(editor.file.encoding)
            self.lbl_filename.setText(editor.file.path)
            self.lbl_interpreter.setText(sys.executable)
        else:
            self.lbl_encoding.clear()
            self.lbl_filename.clear()
            self.lbl_cursor_pos.clear()

    def _enable_run(self):
        self.menuBar.runAct.setEnabled(
            self.tabWidget.current_widget().file.path != '')
        self.menuBar.runConfigAct.setEnabled(
            self.tabWidget.current_widget().file.path != '')

    def on_run(self):
        """
        Run the current current script
        """
        filename = self.tabWidget.current_widget().file.path
        wd = os.path.dirname(filename)
        args = Settings().get_run_config_for_file(filename)
        self.outputDock.iconsole.start_process(
            utils.getInterpreter(),
            args=[filename] + args, cwd=wd)
        self.outputDock.show()
        self.menuBar.runAct.setEnabled(False)
        self.menuBar.runConfigAct.setEnabled(False)

    def on_goto_out_of_doc(self, assignment):
        """
        Open the a new tab when goto goes out of the current document.

        :param assignment: Destination
        """
        editor = self.open_file(assignment.module_path)
        if editor:
            TextHelper(editor).goto_line(assignment.line, assignment.column)

    def on_process_finished(self):
        self.menuBar.runAct.setEnabled(True)
        self.menuBar.runConfigAct.setEnabled(True)

    def on_configure_run(self):
        path = self.tabWidget.current_widget().file.path
        args = Settings().get_run_config_for_file(path)
        text, status = QtWidgets.QInputDialog.getText(
            self, 'Run configuration', 'Script arguments:',
            QtWidgets.QLineEdit.Normal, ' '.join(args))
        if status:
            args = text.split(' ')
            Settings().set_run_config_for_file(path, args)

    @QtCore.Slot()
    def on_cursor_pos_changed(self):
        editor = self.tabWidget.current_widget()
        if editor:
            l, c = TextHelper(editor).cursor_position()
            self.lbl_cursor_pos.setText(
                '%d:%d' % (l + 1, c + 1))

    @QtCore.Slot(WritableObject)
    def pylintFinished(self, out):
        self.pylintDock.outputTE.clear()
        for line in out.read():
            self.pylintDock.outputTE.appendPlainText(line)
        self.pylintDock.show()
def test_splittable_codedit_tab_widget():
    tw = SplittableCodeEditTabWidget()
    tw.show()
    nd = tw.create_new_document()
    QTest.keyPress(nd, 'a')
    w_file = tw.open_document(__file__)
    QTest.qWait(1000)
    other = tw.open_document(server.__file__)
    assert tw.current_widget() == other
    assert other != w_file
    assert tw.open_document(__file__) == w_file
    QTest.qWait(1000)
    assert tw.count() == 3
    tw.rename_document(__file__, __file__ + '.old')
    QTest.qWait(1000)
    tw.close_document(__file__ + '.old')
    QTest.qWait(1000)
    assert tw.count() == 2
    tw.close_document(server.__file__)
    QTest.qWait(1000)
    assert tw.count() == 1
    tw.close_all()
    QTest.qWait(1000)
    assert tw.count() == 0
    tw.close()
    del tw
Example #19
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        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.setObjectName("gridLayout")
        self.tabWidget = SplittableCodeEditTabWidget(self.centralwidget)
        self.tabWidget.setOrientation(QtCore.Qt.Horizontal)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        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.treeView = FileSystemTreeView(self.dockWidgetContents)
        self.treeView.setObjectName("treeView")
        self.gridLayout_2.addWidget(self.treeView, 0, 0, 1, 1)
        self.dockWidget.setWidget(self.dockWidgetContents)
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
        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.actionClose_tab = QtWidgets.QAction(MainWindow)
        self.actionClose_tab.setIconVisibleInMenu(True)
        self.actionClose_tab.setObjectName("actionClose_tab")
        self.actionClose_other_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_other_tabs.setIconVisibleInMenu(True)
        self.actionClose_other_tabs.setObjectName("actionClose_other_tabs")
        self.actionClose_all_tabs = QtWidgets.QAction(MainWindow)
        self.actionClose_all_tabs.setIconVisibleInMenu(True)
        self.actionClose_all_tabs.setObjectName("actionClose_all_tabs")
        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.menuFile.addAction(self.actionNew)
        self.menuFile.addAction(self.actionOpen)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addAction(self.actionSave_as)
        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.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)