Esempio n. 1
0
 def __init__(self, explorer):
     QWidget.__init__(self)
     vbox = QVBoxLayout(self)
     vbox.setContentsMargins(0, 0, 0, 0)
     vbox.addWidget(explorer)
     hbox = QHBoxLayout()
     hbox.setContentsMargins(0, 0, 0, 0)
     self.labelText = "Ln: %s, Col: %s"
     self.labelCursorPosition = QLabel(self.trUtf8(self.labelText % (0, 0)))
     hbox.addWidget(self.labelCursorPosition)
     self.combo = QComboBox()
     ui_tools.ComboBoxButton(self.combo, self.combo.clear, self.style().standardPixmap(self.style().SP_TrashIcon))
     self.combo.setToolTip(
         self.trUtf8(
             "Select the item from the Paste "
             "Historial list.\nYou can Copy items into this list with: "
             "%s\nor Paste them using: %s"
             % (
                 resources.get_shortcut("History-Copy").toString(QKeySequence.NativeText),
                 resources.get_shortcut("History-Paste").toString(QKeySequence.NativeText),
             )
         )
     )
     self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     hbox.addWidget(self.combo)
     vbox.addLayout(hbox)
Esempio n. 2
0
    def __init__(self, parent=None):
        super(SearchWidget, self).__init__(parent)
        hSearch = QHBoxLayout(self)
        hSearch.setContentsMargins(0, 0, 0, 0)
        self._checkSensitive = QCheckBox(translations.TR_SEARCH_CASE_SENSITIVE)
        self._checkWholeWord = QCheckBox(translations.TR_SEARCH_WHOLE_WORDS)
        self._line = TextLine(self)
        self._line.setMinimumWidth(250)
        self._btnClose = QPushButton(
            self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
        self._btnClose.setIconSize(QSize(16, 16))
        self._btnFind = QPushButton(QIcon(":img/find"), '')
        self._btnFind.setIconSize(QSize(16, 16))
        self.btnPrevious = QPushButton(
            self.style().standardIcon(QStyle.SP_ArrowLeft), '')
        self.btnPrevious.setIconSize(QSize(16, 16))
        self.btnPrevious.setToolTip(
            self.trUtf8("Press %s") %
            resources.get_shortcut("Find-previous").toString(
                QKeySequence.NativeText))
        self.btnNext = QPushButton(
            self.style().standardIcon(QStyle.SP_ArrowRight), '')
        self.btnNext.setIconSize(QSize(16, 16))
        self.btnNext.setToolTip(
            self.trUtf8("Press %s") %
            resources.get_shortcut("Find-next").toString(
                QKeySequence.NativeText))
        hSearch.addWidget(self._btnClose)
        hSearch.addWidget(self._line)
        hSearch.addWidget(self._btnFind)
        hSearch.addWidget(self.btnPrevious)
        hSearch.addWidget(self.btnNext)
        hSearch.addWidget(self._checkSensitive)
        hSearch.addWidget(self._checkWholeWord)

        self.totalMatches = 0
        self.index = 0
        self._line.counter.update_count(self.index, self.totalMatches)

        self.connect(self._btnFind, SIGNAL("clicked()"),
                     self.find)
        self.connect(self.btnNext, SIGNAL("clicked()"),
                     self.find_next)
        self.connect(self.btnPrevious, SIGNAL("clicked()"),
                     self.find_previous)
        self.connect(self._checkSensitive, SIGNAL("stateChanged(int)"),
                     self._states_changed)
        self.connect(self._checkWholeWord, SIGNAL("stateChanged(int)"),
                     self._states_changed)

        IDE.register_service('status_search', self)
Esempio n. 3
0
    def __init__(self, menuAbout):
        QObject.__init__(self)

        startPageAction = menuAbout.addAction(self.tr("Show Start Page"))
        helpAction = menuAbout.addAction(self.tr("Python Help (%s)" %
            resources.get_shortcut("Help").toString(QKeySequence.NativeText)))
        menuAbout.addSeparator()
        reportBugAction = menuAbout.addAction(self.tr("Report Bugs!"))
        pluginsDocAction = menuAbout.addAction(
                                        self.tr("Plugins Documentation"))
        menuAbout.addSeparator()

        aboutNinjaAction = menuAbout.addAction(self.tr("About NINJA-IDE"))
        aboutQtAction = menuAbout.addAction(self.tr("About Qt"))

        #Connect Action SIGNALs to proper functions
        self.connect(startPageAction, SIGNAL("triggered()"),
            main_container.MainContainer().show_start_page)

        self.connect(reportBugAction, SIGNAL("triggered()"),
            self.show_report_bugs)
        self.connect(aboutQtAction, SIGNAL("triggered()"),
                            self._show_about_qt)
        self.connect(helpAction, SIGNAL("triggered()"),
            main_container.MainContainer().show_python_doc)
        self.connect(aboutNinjaAction, SIGNAL("triggered()"),
                            self._show_about_ninja)
        self.connect(pluginsDocAction, SIGNAL("triggered()"),
            self.show_plugins_doc)
Esempio n. 4
0
    def __init__(self, menuProject, toolbar):
        QObject.__init__(self)

        runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
            self.tr("Run Project (%s)" %
                resources.get_shortcut("Run-project").toString(
                    QKeySequence.NativeText)))
#        debugAction = menuProject.addAction(
#            QIcon(resources.IMAGES['debug']),
#            self.tr("Debug Project (%s)" %
#                resources.get_shortcut("Debug").toString(
#                    QKeySequence.NativeText)))
        runFileAction = menuProject.addAction(
            QIcon(resources.IMAGES['file-run']),
            self.tr(u"Run File (%s)".format( 
                resources.get_shortcut("Run-file").toString(
                    QKeySequence.NativeText))))
        stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
            self.tr("Stop (%s)".format(
                resources.get_shortcut("Stop-execution").toString(
                    QKeySequence.NativeText))))
        menuProject.addSeparator()
        projectPropertiesAction = menuProject.addAction(
            self.tr("Open Project Properties"))
        menuProject.addSeparator()
        previewAction = menuProject.addAction(
            QIcon(resources.IMAGES['preview-web']),
            self.tr("Preview Web in Default Browser"))
#        diagramView = menuProject.addAction(self.tr("Diagram View"))

        self.toolbar_items = {
            'run-project': runAction,
            'run-file': runFileAction,
            'stop': stopAction,
            'preview-web': previewAction}

        self.connect(runAction, SIGNAL("triggered()"),
            actions.Actions().execute_project)
        self.connect(runFileAction, SIGNAL("triggered()"),
            actions.Actions().execute_file)
        self.connect(stopAction, SIGNAL("triggered()"),
            actions.Actions().kill_execution)
        self.connect(previewAction, SIGNAL("triggered()"),
            actions.Actions().preview_in_browser)
        self.connect(projectPropertiesAction, SIGNAL("triggered()"),
            actions.Actions().open_project_properties)
Esempio n. 5
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self._parent = parent
        hSearch = QHBoxLayout(self)
        hSearch.setContentsMargins(0, 0, 0, 0)
        self._checkSensitive = QCheckBox(self.tr("Respect Case Sensitive"))
        self._checkWholeWord = QCheckBox(self.tr("Find Whole Words"))
        self._line = TextLine(self)
        self._line.setMinimumWidth(250)
        self._btnClose = QPushButton(
            self.style().standardIcon(QStyle.SP_DialogCloseButton), '')
        self._btnFind = QPushButton(QIcon(resources.IMAGES['find']), '')
        self.btnPrevious = QPushButton(
            self.style().standardIcon(QStyle.SP_ArrowLeft), '')
        self.btnPrevious.setToolTip(self.tr(u"Press %s".format(
                resources.get_shortcut("Find-previous").toString(
                    QKeySequence.NativeText))))
        self.btnNext = QPushButton(
            self.style().standardIcon(QStyle.SP_ArrowRight), '')
        self.btnNext.setToolTip(self.tr(u"Press %s".format( 
                resources.get_shortcut("Find-next").toString(
                    QKeySequence.NativeText))))
        hSearch.addWidget(self._btnClose)
        hSearch.addWidget(self._line)
        hSearch.addWidget(self._btnFind)
        hSearch.addWidget(self.btnPrevious)
        hSearch.addWidget(self.btnNext)
        hSearch.addWidget(self._checkSensitive)
        hSearch.addWidget(self._checkWholeWord)

        self.totalMatches = 0
        self.index = 0
        self._line.counter.update_count(self.index, self.totalMatches)

        self.connect(self._btnClose, SIGNAL("clicked()"),
            self._parent.hide_status)
        self.connect(self._btnFind, SIGNAL("clicked()"),
            self.find_next)
        self.connect(self.btnNext, SIGNAL("clicked()"),
            self.find_next)
        self.connect(self.btnPrevious, SIGNAL("clicked()"),
            self.find_previous)
        self.connect(self._checkSensitive, SIGNAL("stateChanged(int)"),
            self._checks_state_changed)
        self.connect(self._checkWholeWord, SIGNAL("stateChanged(int)"),
            self._checks_state_changed)
Esempio n. 6
0
 def _load_shortcuts(self):
     for action in resources.CUSTOM_SHORTCUTS:
         shortcut_action = resources.get_shortcut(action)
         #populate the tree widget
         tree_data = [self.shortcuts_text[action],
             shortcut_action.toString(QKeySequence.NativeText), action]
         item = QTreeWidgetItem(self.result_widget, tree_data)
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
 def __init__(self, parent=None):
     super(LateralPanel, self).__init__(parent)
     self.has_component = False
     self.vbox = QVBoxLayout(self)
     self.vbox.setContentsMargins(0, 0, 0, 0)
     hbox = QHBoxLayout()
     hbox.setContentsMargins(0, 0, 5, 5)
     self.combo = QComboBox()
     ui_tools.ComboBoxButton(self.combo, self.combo.clear,
         self.style().standardPixmap(self.style().SP_TrashIcon))
     self.combo.setToolTip(self.tr("Select the item from the Paste "
         "History list.\nYou can Copy items into this list with: "
         "%s\nor Paste them using: %s") %
             (resources.get_shortcut("History-Copy").toString(
                 QKeySequence.NativeText),
             resources.get_shortcut("History-Paste").toString(
                 QKeySequence.NativeText)))
     self.combo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     hbox.addWidget(self.combo)
     self.vbox.addLayout(hbox)
Esempio n. 8
0
    def __init__(self, menuProject, toolbar):
        super(MenuProject, self).__init__()

        runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
            (_translate("MenuProject", "Run Project (%s)") %
                resources.get_shortcut("Run-project").toString(
                    QKeySequence.NativeText)))
#        debugAction = menuProject.addAction(
#            QIcon(resources.IMAGES['debug']),
#            _translate("MenuProject", "Debug Project (%s)" %
#                resources.get_shortcut("Debug").toString(
#                    QKeySequence.NativeText)))
        runFileAction = menuProject.addAction(
            QIcon(resources.IMAGES['file-run']),
            (_translate("MenuProject", "Run File (%s)") %
                resources.get_shortcut("Run-file").toString(
                    QKeySequence.NativeText)))
        stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
            (_translate("MenuProject", "Stop (%s)") %
                resources.get_shortcut("Stop-execution").toString(
                    QKeySequence.NativeText)))
        menuProject.addSeparator()
        projectPropertiesAction = menuProject.addAction(
            _translate("MenuProject", "Open Project Properties"))
        menuProject.addSeparator()
        previewAction = menuProject.addAction(
            QIcon(resources.IMAGES['preview-web']),
            _translate("MenuProject", "Preview Web in Default Browser"))
#        diagramView = menuProject.addAction(_translate("MenuProject", "Diagram View"))

        self.toolbar_items = {
            'run-project': runAction,
            'run-file': runFileAction,
            'stop': stopAction,
            'preview-web': previewAction}

        runAction.triggered.connect(actions.Actions().execute_project)
        runFileAction.triggered.connect(actions.Actions().execute_file)
        stopAction.triggered.connect(actions.Actions().kill_execution)
        previewAction.triggered.connect(actions.Actions().preview_in_browser)
        projectPropertiesAction.triggered.connect(actions.Actions().open_project_properties)
    def __init__(self, parent):
        super(EditorCompletion, self).__init__()
        self._preferences = parent
        vbox = QVBoxLayout(self)

        groupBoxClose = QGroupBox(translations.TR_PREF_EDITOR_COMPLETE)
        formClose = QGridLayout(groupBoxClose)
        formClose.setContentsMargins(5, 15, 5, 5)
        self._checkParentheses = QCheckBox(
            translations.TR_PREF_EDITOR_PARENTHESES + " ()")
        self._checkParentheses.setChecked('(' in settings.BRACES)
        self._checkKeys = QCheckBox(translations.TR_PREF_EDITOR_KEYS + " {}")
        self._checkKeys.setChecked('{' in settings.BRACES)
        self._checkBrackets = QCheckBox(
            translations.TR_PREF_EDITOR_BRACKETS + " []")
        self._checkBrackets.setChecked('[' in settings.BRACES)
        self._checkSimpleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_SIMPLE_QUOTES)
        self._checkSimpleQuotes.setChecked("'" in settings.QUOTES)
        self._checkDoubleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_DOUBLE_QUOTES)
        self._checkDoubleQuotes.setChecked('"' in settings.QUOTES)
        self._checkCompleteDeclarations = QCheckBox(
            translations.TR_PREF_EDITOR_COMPLETE_DECLARATIONS.format(
            resources.get_shortcut("Complete-Declarations").toString(
                    QKeySequence.NativeText)))
        self._checkCompleteDeclarations.setChecked(
            settings.COMPLETE_DECLARATIONS)
        formClose.addWidget(self._checkParentheses, 1, 1,
            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkKeys, 1, 2, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkBrackets, 2, 1, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkSimpleQuotes, 2, 2,
            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkDoubleQuotes, 3, 1,
            alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxClose)

        groupBoxCode = QGroupBox(translations.TR_PREF_EDITOR_CODE_COMPLETION)
        formCode = QGridLayout(groupBoxCode)
        formCode.setContentsMargins(5, 15, 5, 5)
        self._checkCodeDot = QCheckBox(
            translations.TR_PREF_EDITOR_ACTIVATE_COMPLETION)
        self._checkCodeDot.setChecked(settings.CODE_COMPLETION)
        formCode.addWidget(self._checkCompleteDeclarations, 5, 1,
            alignment=Qt.AlignTop)

        formCode.addWidget(self._checkCodeDot, 6, 1, alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxCode)
        vbox.addItem(QSpacerItem(0, 10, QSizePolicy.Expanding,
            QSizePolicy.Expanding))

        self._preferences.savePreferences.connect(self.save)
Esempio n. 10
0
    def __init__(self, menuProject, toolbar):
        QObject.__init__(self)

        runAction = menuProject.addAction(QIcon(resources.IMAGES['play']),
            self.tr("Run Project (%1)").arg(
                resources.get_shortcut("Run-project").toString(
                    QKeySequence.NativeText)))
#        debugAction = menuProject.addAction(
#            QIcon(resources.IMAGES['debug']),
#            self.tr("Debug Project (%1)").arg(
#                resources.get_shortcut("Debug").toString(
#                    QKeySequence.NativeText)))
        runFileAction = menuProject.addAction(
            QIcon(resources.IMAGES['file-run']),
            self.tr("Run File (%1)").arg(
                resources.get_shortcut("Run-file").toString(
                    QKeySequence.NativeText)))
        stopAction = menuProject.addAction(QIcon(resources.IMAGES['stop']),
            self.tr("Stop (%1)").arg(
                resources.get_shortcut("Stop-execution").toString(
                    QKeySequence.NativeText)))
        menuProject.addSeparator()
        previewAction = menuProject.addAction(
            self.tr("Preview Web in Default Browser"))
#        diagramView = menuProject.addAction(self.tr("Diagram View"))

        toolbar.addAction(runAction)
#        toolbar.addAction(debugAction)
        toolbar.addAction(runFileAction)
        toolbar.addAction(stopAction)
        toolbar.addSeparator()

        self.connect(runAction, SIGNAL("triggered()"),
            actions.Actions().execute_project)
        self.connect(runFileAction, SIGNAL("triggered()"),
            actions.Actions().execute_file)
        self.connect(stopAction, SIGNAL("triggered()"),
            actions.Actions().kill_execution)
        self.connect(previewAction, SIGNAL("triggered()"),
            actions.Actions().preview_in_browser)
Esempio n. 11
0
def install_shortcuts(obj, actions, ide):
    short = resources.get_shortcut
    for action in actions:
        short_key = action.get("shortcut", None)
        action_data = action.get("action", None)
        connect = action.get("connect", None)

        shortcut = None
        item_ui = None
        func = None
        if connect:
            func = getattr(obj, connect, None)

        if short_key and not action_data:
            shortcut = QShortcut(short(short_key), ide)
            if isinstance(func, collections.Callable):
                ide.connect(shortcut, SIGNAL("activated()"), func)
        if action_data:
            is_menu = action_data.get('is_menu', False)
            if is_menu:
                item_ui = QMenu(action_data['text'], ide)
            else:
                item_ui = QAction(action_data['text'], ide)
                object_name = "%s.%s" % (obj.__class__.__name__, connect)
                item_ui.setObjectName(object_name)
            image_name = action_data.get('image', None)
            section = action_data.get('section', None)
            weight = action_data.get('weight', None)
            keysequence = action_data.get('keysequence', None)
            if image_name:
                if isinstance(image_name, int):
                    icon = ide.style().standardIcon(image_name)
                    item_ui.setIcon(icon)
                elif isinstance(image_name, str):
                    icon = QIcon(":img/" + image_name)
                    item_ui.setIcon(icon)
            if short_key and not is_menu:
                item_ui.setShortcut(short(short_key))
            elif keysequence:
                item_ui.setShortcut(resources.get_shortcut(keysequence))
            if isinstance(func, collections.Callable) and not is_menu:
                ide.connect(item_ui, SIGNAL("triggered()"), func)
            if section and weight:
                ide.register_menuitem(item_ui, section, weight)
                if image_name and not is_menu:
                    ide.register_toolbar(item_ui, section, weight)

        if short_key and shortcut:
            ide.register_shortcut(short_key, shortcut, item_ui)
Esempio n. 12
0
    def __init__(self, menuAbout):
        super(MenuAbout, self).__init__()

        startPageAction = menuAbout.addAction(_translate("MenuAbout", "Show Start Page"))
        helpAction = menuAbout.addAction(_translate("MenuAbout", "Python Help (%s)") %
            resources.get_shortcut("Help").toString(QKeySequence.NativeText))
        menuAbout.addSeparator()
        reportBugAction = menuAbout.addAction(_translate("MenuAbout", "Report Bugs!"))
        pluginsDocAction = menuAbout.addAction(
                                        _translate("MenuAbout", "Plugins Documentation"))
        menuAbout.addSeparator()

        aboutNinjaAction = menuAbout.addAction(_translate("MenuAbout", "About NINJA-IDE"))
        aboutQtAction = menuAbout.addAction(_translate("MenuAbout", "About Qt"))

        #Connect Action SIGNALs to proper functions
        startPageAction.triggered.connect(main_container.MainContainer().show_start_page)

        startPageAction.triggered.connect(self.show_report_bugs)
        aboutQtAction.triggered.connect(self._show_about_qt)
        helpAction.triggered.connect(main_container.MainContainer().show_python_doc)
        helpAction.triggered.connect(self._show_about_ninja)
        pluginsDocAction.triggered.connect(self.show_plugins_doc)
Esempio n. 13
0
    def __init__(self, menuSource):
        QObject.__init__(self)

        indentMoreAction = menuSource.addAction(
            QIcon(resources.IMAGES['indent-more']),
            self.tr("Indent More (%1)").arg(
                QKeySequence(Qt.Key_Tab).toString(QKeySequence.NativeText)))
        indentLessAction = menuSource.addAction(
            QIcon(resources.IMAGES['indent-less']),
            self.tr("Indent Less (%1)").arg(
                resources.get_shortcut("Indent-less").toString(
                    QKeySequence.NativeText)))
        menuSource.addSeparator()
        commentAction = menuSource.addAction(
            QIcon(resources.IMAGES['comment-code']),
            self.tr("Comment (%1)").arg(
                resources.get_shortcut("Comment").toString(
                    QKeySequence.NativeText)))
        unCommentAction = menuSource.addAction(
            QIcon(resources.IMAGES['uncomment-code']),
            self.tr("Uncomment (%1)").arg(
                resources.get_shortcut("Uncomment").toString(
                    QKeySequence.NativeText)))
        horizontalLineAction = menuSource.addAction(
            self.tr("Insert Horizontal Line (%1)").arg(
                resources.get_shortcut("Horizontal-line").toString(
                    QKeySequence.NativeText)))
        titleCommentAction = menuSource.addAction(
            self.tr("Insert Title Comment (%1)").arg(
                resources.get_shortcut("Title-comment").toString(
                    QKeySequence.NativeText)))
        countCodeLinesAction = menuSource.addAction(
            self.tr("Count Code Lines"))
        menuSource.addSeparator()
#        tellTaleAction = menuSource.addAction(
#            self.tr("Tell me a Tale of Code"))
#        tellTaleAction.setEnabled(False)
        goToDefinitionAction = menuSource.addAction(
            QIcon(resources.IMAGES['go-to-definition']),
            self.tr("Go To Definition (%1 or %2+Click)").arg(
                resources.get_shortcut("Go-to-definition").toString(
                    QKeySequence.NativeText),
                settings.OS_KEY))
        insertImport = menuSource.addAction(
            QIcon(resources.IMAGES['insert-import']),
            self.tr("Insert &Import (%1)").arg(
                resources.get_shortcut("Import").toString(
                    QKeySequence.NativeText)))
        menu_debugging = menuSource.addMenu(self.tr("Debugging Tricks"))
        insertPrints = menu_debugging.addAction(
            self.tr("Insert Prints per selected line."))
#        organizeImportsAction = menuSource.addAction(
#            self.tr("&Organize Imports"))
#        removeUnusedImportsAction = menuSource.addAction(
#            self.tr("Remove Unused &Imports"))
#        extractMethodAction = menuSource.addAction(
#            self.tr("Extract selected &code as Method"))
        menuSource.addSeparator()
        removeTrailingSpaces = menuSource.addAction(
            self.tr("&Remove Trailing Spaces"))
        replaceTabsSpaces = menuSource.addAction(
            self.tr("Replace Tabs With &Spaces"))
        moveUp = menuSource.addAction(self.tr("Move &Up (%1)").arg(
            resources.get_shortcut("Move-up").toString(
                QKeySequence.NativeText)))
        moveDown = menuSource.addAction(self.tr("Move &Down (%1)").arg(
            resources.get_shortcut("Move-down").toString(
                QKeySequence.NativeText)))
        duplicate = menuSource.addAction(
            self.tr("Duplica&te (%1)").arg(
                resources.get_shortcut("Duplicate").toString(
                    QKeySequence.NativeText)))
        remove = menuSource.addAction(
            self.tr("&Remove Line (%1)").arg(
                resources.get_shortcut("Remove-line").toString(
                    QKeySequence.NativeText)))

        self.toolbar_items = {
            'indent-more': indentMoreAction,
            'indent-less': indentLessAction,
            'comment': commentAction,
            'uncomment': unCommentAction,
            'go-to-definition': goToDefinitionAction,
            'insert-import': insertImport}

        self.connect(goToDefinitionAction, SIGNAL("triggered()"),
            actions.Actions().editor_go_to_definition)
        self.connect(countCodeLinesAction, SIGNAL("triggered()"),
            actions.Actions().count_file_code_lines)
        self.connect(insertImport, SIGNAL("triggered()"),
            actions.Actions().import_from_everywhere)
        self.connect(indentMoreAction, SIGNAL("triggered()"),
            actions.Actions().editor_indent_more)
        self.connect(indentLessAction, SIGNAL("triggered()"),
            actions.Actions().editor_indent_less)
        self.connect(commentAction, SIGNAL("triggered()"),
            actions.Actions().editor_comment)
        self.connect(unCommentAction, SIGNAL("triggered()"),
            actions.Actions().editor_uncomment)
        self.connect(horizontalLineAction, SIGNAL("triggered()"),
            actions.Actions().editor_insert_horizontal_line)
        self.connect(titleCommentAction, SIGNAL("triggered()"),
            actions.Actions().editor_insert_title_comment)
#        QObject.connect(removeUnusedImportsAction, SIGNAL("triggered()"),
#        lambda: self._main._central.obtain_editor().remove_unused_imports())
##        QObject.connect(addMissingImportsAction, SIGNAL("triggered()"),
#        lambda: self._main._central.obtain_editor().add_missing_imports())
#        QObject.connect(organizeImportsAction, SIGNAL("triggered()"),
#        lambda: self._main._central.obtain_editor().organize_imports())
#        QObject.connect(extractMethodAction, SIGNAL("triggered()"),
#        lambda: self._main._central.obtain_editor().extract_method())
        self.connect(moveUp, SIGNAL("triggered()"),
            actions.Actions().editor_move_up)
        self.connect(moveDown, SIGNAL("triggered()"),
            actions.Actions().editor_move_down)
        self.connect(duplicate, SIGNAL("triggered()"),
            actions.Actions().editor_duplicate)
        self.connect(replaceTabsSpaces, SIGNAL("triggered()"),
            actions.Actions().editor_replace_tabs_with_spaces)
        self.connect(removeTrailingSpaces, SIGNAL("triggered()"),
            actions.Actions().editor_remove_trailing_spaces)
        self.connect(remove, SIGNAL("triggered()"),
            actions.Actions().editor_remove_line)
        self.connect(insertPrints, SIGNAL("triggered()"),
            actions.Actions().editor_insert_debugging_prints)
Esempio n. 14
0
    def __init__(self, menuFile, toolbar, ide):
        QObject.__init__(self)

        newAction = menuFile.addAction(
            QIcon(resources.IMAGES["new"]),
            self.tr("&New File (%s)" % resources.get_shortcut("New-file").toString(QKeySequence.NativeText)),
        )
        newProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES["newProj"]),
            self.tr("New Pro&ject (%s)" % resources.get_shortcut("New-project").toString(QKeySequence.NativeText)),
        )
        menuFile.addSeparator()
        saveAction = menuFile.addAction(
            QIcon(resources.IMAGES["save"]),
            self.tr("&Save (%s)" % resources.get_shortcut("Save-file").toString(QKeySequence.NativeText)),
        )
        saveAsAction = menuFile.addAction(QIcon(resources.IMAGES["saveAs"]), self.tr("Save &As"))
        saveAllAction = menuFile.addAction(QIcon(resources.IMAGES["saveAll"]), self.tr("Save All"))
        saveProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES["saveAll"]),
            self.tr("Save Pro&ject  (%s)" % resources.get_shortcut("Save-project").toString(QKeySequence.NativeText)),
        )
        menuFile.addSeparator()
        reloadFileAction = menuFile.addAction(
            QIcon(resources.IMAGES["reload-file"]),
            self.tr("Reload File (%s)" % resources.get_shortcut("Reload-file").toString(QKeySequence.NativeText)),
        )
        menuFile.addSeparator()
        openAction = menuFile.addAction(
            QIcon(resources.IMAGES["open"]),
            self.tr("&Open (%s)" % resources.get_shortcut("Open-file").toString(QKeySequence.NativeText)),
        )
        openProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES["openProj"]),
            self.tr("Open &Project (%s)" % resources.get_shortcut("Open-project").toString(QKeySequence.NativeText)),
        )
        self.recent_files = menuFile.addMenu(self.tr("Open Recent Files"))
        menuFile.addSeparator()
        activateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES["activate-profile"]), self.tr("Activate Profile")
        )
        deactivateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES["deactivate-profile"]), self.tr("Deactivate Profile")
        )
        menuFile.addSeparator()
        printFile = menuFile.addAction(
            QIcon(resources.IMAGES["print"]),
            self.tr("Pr&int File (%s)" % resources.get_shortcut("Print-file").toString(QKeySequence.NativeText)),
        )
        closeAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Close Tab (%s)" % resources.get_shortcut("Close-tab").toString(QKeySequence.NativeText)),
        )
        closeProjectsAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton), self.tr("&Close All Projects")
        )
        menuFile.addSeparator()
        exitAction = menuFile.addAction(ide.style().standardIcon(QStyle.SP_DialogCloseButton), self.tr("&Exit"))

        self.toolbar_items = {
            "new-file": newAction,
            "new-project": newProjectAction,
            "save-file": saveAction,
            "save-as": saveAsAction,
            "save-all": saveAllAction,
            "save-project": saveProjectAction,
            "reload-file": reloadFileAction,
            "open-file": openAction,
            "open-project": openProjectAction,
            "activate-profile": activateProfileAction,
            "deactivate-profile": deactivateProfileAction,
            "print-file": printFile,
            "close-file": closeAction,
            "close-projects": closeProjectsAction,
        }

        self.connect(newAction, SIGNAL("triggered()"), ide.mainContainer.add_editor)
        self.connect(newProjectAction, SIGNAL("triggered()"), ide.explorer.create_new_project)
        self.connect(openAction, SIGNAL("triggered()"), ide.mainContainer.open_file)
        self.connect(saveAction, SIGNAL("triggered()"), ide.mainContainer.save_file)
        self.connect(saveAsAction, SIGNAL("triggered()"), ide.mainContainer.save_file_as)
        self.connect(saveAllAction, SIGNAL("triggered()"), ide.actions.save_all)
        self.connect(saveProjectAction, SIGNAL("triggered()"), ide.actions.save_project)
        self.connect(openProjectAction, SIGNAL("triggered()"), ide.explorer.open_project_folder)
        self.connect(closeAction, SIGNAL("triggered()"), ide.mainContainer.actualTab.close_tab)
        self.connect(exitAction, SIGNAL("triggered()"), ide.close)
        QObject.connect(reloadFileAction, SIGNAL("triggered()"), ide.mainContainer.reload_file)
        self.connect(printFile, SIGNAL("triggered()"), ide.actions.print_file)
        self.connect(closeProjectsAction, SIGNAL("triggered()"), ide.explorer.close_opened_projects)
        self.connect(deactivateProfileAction, SIGNAL("triggered()"), ide.actions.deactivate_profile)
        self.connect(activateProfileAction, SIGNAL("triggered()"), ide.actions.activate_profile)
        self.connect(self.recent_files, SIGNAL("triggered(QAction*)"), self._open_file)
Esempio n. 15
0
    def __init__(self, menuFile, toolbar, ide):
        QObject.__init__(self)

        newAction = menuFile.addAction(
            QIcon(resources.IMAGES['new']),
            (self.trUtf8("&New File (%s)") %
             resources.get_shortcut("New-file").toString(
                 QKeySequence.NativeText)))
        newProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['newProj']),
            (self.trUtf8("New Pro&ject (%s)") %
             resources.get_shortcut("New-project").toString(
                 QKeySequence.NativeText)))
        menuFile.addSeparator()
        saveAction = menuFile.addAction(
            QIcon(resources.IMAGES['save']),
            (self.trUtf8("&Save (%s)") %
             resources.get_shortcut("Save-file").toString(
                 QKeySequence.NativeText)))
        saveAsAction = menuFile.addAction(QIcon(resources.IMAGES['saveAs']),
                                          self.trUtf8("Save &As"))
        saveAllAction = menuFile.addAction(QIcon(resources.IMAGES['saveAll']),
                                           self.trUtf8("Save All"))
        saveProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['saveAll']),
            (self.trUtf8("Save Pro&ject  (%s)") %
             resources.get_shortcut("Save-project").toString(
                 QKeySequence.NativeText)))
        menuFile.addSeparator()
        reloadFileAction = menuFile.addAction(
            QIcon(resources.IMAGES['reload-file']),
            (self.trUtf8("Reload File (%s)") %
             resources.get_shortcut("Reload-file").toString(
                 QKeySequence.NativeText)))
        menuFile.addSeparator()
        openAction = menuFile.addAction(
            QIcon(resources.IMAGES['open']),
            (self.trUtf8("&Open (%s)") %
             resources.get_shortcut("Open-file").toString(
                 QKeySequence.NativeText)))
        openProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['openProj']),
            (self.trUtf8("Open &Project (%s)") %
             resources.get_shortcut("Open-project").toString(
                 QKeySequence.NativeText)))
        self.recent_files = menuFile.addMenu(self.trUtf8('Open Recent Files'))
        menuFile.addSeparator()
        activateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['activate-profile']),
            self.trUtf8("Activate Profile"))
        deactivateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['deactivate-profile']),
            self.trUtf8("Deactivate Profile"))
        menuFile.addSeparator()
        printFile = menuFile.addAction(
            QIcon(resources.IMAGES['print']),
            (self.trUtf8("Pr&int File (%s)") %
             resources.get_shortcut("Print-file").toString(
                 QKeySequence.NativeText)))
        closeAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            (self.trUtf8("&Close Tab (%s)") %
             resources.get_shortcut("Close-tab").toString(
                 QKeySequence.NativeText)))
        closeProjectsAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.trUtf8("&Close All Projects"))
        menuFile.addSeparator()
        exitAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.trUtf8("&Exit"))

        self.toolbar_items = {
            'new-file': newAction,
            'new-project': newProjectAction,
            'save-file': saveAction,
            'save-as': saveAsAction,
            'save-all': saveAllAction,
            'save-project': saveProjectAction,
            'reload-file': reloadFileAction,
            'open-file': openAction,
            'open-project': openProjectAction,
            'activate-profile': activateProfileAction,
            'deactivate-profile': deactivateProfileAction,
            'print-file': printFile,
            'close-file': closeAction,
            'close-projects': closeProjectsAction
        }

        self.connect(newAction, SIGNAL("triggered()"),
                     ide.mainContainer.add_editor)
        self.connect(newProjectAction, SIGNAL("triggered()"),
                     ide.explorer.create_new_project)
        self.connect(openAction, SIGNAL("triggered()"),
                     ide.mainContainer.open_file)
        self.connect(saveAction, SIGNAL("triggered()"),
                     ide.mainContainer.save_file)
        self.connect(saveAsAction, SIGNAL("triggered()"),
                     ide.mainContainer.save_file_as)
        self.connect(saveAllAction, SIGNAL("triggered()"),
                     ide.actions.save_all)
        self.connect(saveProjectAction, SIGNAL("triggered()"),
                     ide.actions.save_project)
        self.connect(openProjectAction, SIGNAL("triggered()"),
                     ide.explorer.open_project_folder)
        self.connect(closeAction, SIGNAL("triggered()"),
                     ide.mainContainer.actualTab.close_tab)
        self.connect(exitAction, SIGNAL("triggered()"), ide.close)
        QObject.connect(reloadFileAction, SIGNAL("triggered()"),
                        ide.mainContainer.reload_file)
        self.connect(printFile, SIGNAL("triggered()"), ide.actions.print_file)
        self.connect(closeProjectsAction, SIGNAL("triggered()"),
                     ide.explorer.close_opened_projects)
        self.connect(deactivateProfileAction, SIGNAL("triggered()"),
                     ide.actions.deactivate_profile)
        self.connect(activateProfileAction, SIGNAL("triggered()"),
                     ide.actions.activate_profile)
        self.connect(self.recent_files, SIGNAL("triggered(QAction*)"),
                     self._open_file)
Esempio n. 16
0
    def __init__(self, menuView, toolbar, ide):
        QObject.__init__(self)
        self.__ide = ide

        self.hideConsoleAction = menuView.addAction(
            self.tr("Show/Hide &Console (%1)").arg(
                resources.get_shortcut("Hide-misc").toString(
                    QKeySequence.NativeText)))
        self.hideEditorAction = menuView.addAction(
            self.tr("Show/Hide &Editor (%1)").arg(
                resources.get_shortcut("Hide-editor").toString(
                    QKeySequence.NativeText)))
        self.hideAllAction = menuView.addAction(
            self.tr("Show/Hide &All (%1)").arg(
                resources.get_shortcut("Hide-all").toString(
                    QKeySequence.NativeText)))
        self.hideExplorerAction = menuView.addAction(
            self.tr("Show/Hide &Explorer (%1)").arg(
                resources.get_shortcut("Hide-explorer").toString(
                    QKeySequence.NativeText)))
        self.hideToolbarAction = menuView.addAction(
            self.tr("Show/Hide &Toolbar"))
        self.fullscreenAction = menuView.addAction(
            self.tr("Full Screen &Mode (%1)").arg(
                resources.get_shortcut("Full-screen").toString(
                    QKeySequence.NativeText)))
        menuView.addSeparator()
        splitTabHAction = menuView.addAction(
            QIcon(resources.IMAGES['splitH']),
            self.tr("Split Tabs Horizontally (%1)").arg(
                resources.get_shortcut("Split-horizontal").toString(
                    QKeySequence.NativeText)))
        splitTabVAction = menuView.addAction(
            QIcon(resources.IMAGES['splitV']),
            self.tr("Split Tabs Vertically (%1)").arg(
                resources.get_shortcut("Split-vertical").toString(
                    QKeySequence.NativeText)))
        followModeAction = menuView.addAction(
            QIcon(resources.IMAGES['follow']),
            self.tr("Follow Mode (%1)").arg(
                resources.get_shortcut("Follow-mode").toString(
                    QKeySequence.NativeText)))
        groupTabsAction = menuView.addAction(self.tr("Group Tabs by Project"))
        deactivateGroupTabsAction = menuView.addAction(
            self.tr("Deactivate Group Tabs"))
        menuView.addSeparator()
        #Zoom
        zoomInAction = menuView.addAction(
            self.tr("Zoom &In (%1+Wheel-Up)").arg(settings.OS_KEY))
        zoomOutAction = menuView.addAction(
            self.tr("Zoom &Out (%1+Wheel-Down)").arg(settings.OS_KEY))
        menuView.addSeparator()
        fadeInAction = menuView.addAction(self.tr("Fade In (Alt+Wheel-Up)"))
        fadeOutAction = menuView.addAction(
            self.tr("Fade Out (Alt+Wheel-Down)"))

        toolbar.addAction(splitTabHAction)
        toolbar.addAction(splitTabVAction)
        toolbar.addAction(followModeAction)
        toolbar.addSeparator()

        self.connect(self.hideConsoleAction, SIGNAL("triggered()"),
            self.__ide.central.change_misc_visibility)
        self.connect(self.hideEditorAction, SIGNAL("triggered()"),
            self.__ide.central.change_main_visibility)
        self.connect(self.hideExplorerAction, SIGNAL("triggered()"),
            self.__ide.central.change_explorer_visibility)
        self.connect(self.hideAllAction, SIGNAL("triggered()"),
            self.__ide.actions.hide_all)
        self.connect(self.fullscreenAction, SIGNAL("triggered()"),
            self.__ide.actions.fullscreen_mode)
        self.connect(splitTabHAction, SIGNAL("triggered()"),
            lambda: self.__ide.mainContainer.split_tab(True))
        self.connect(splitTabVAction, SIGNAL("triggered()"),
            lambda: self.__ide.mainContainer.split_tab(False))
        QObject.connect(followModeAction, SIGNAL("triggered()"),
            self.__ide.mainContainer.show_follow_mode)
        self.connect(zoomInAction, SIGNAL("triggered()"),
            self.zoom_in_editor)
        self.connect(zoomOutAction, SIGNAL("triggered()"),
            self.zoom_out_editor)
        self.connect(fadeInAction, SIGNAL("triggered()"), self._fade_in)
        self.connect(fadeOutAction, SIGNAL("triggered()"), self._fade_out)
        self.connect(self.hideToolbarAction, SIGNAL("triggered()"),
            self._hide_show_toolbar)
        self.connect(groupTabsAction, SIGNAL("triggered()"),
            self.__ide.actions.group_tabs_together)
        self.connect(deactivateGroupTabsAction, SIGNAL("triggered()"),
            self.__ide.actions.deactivate_tabs_groups)
Esempio n. 17
0
    def __init__(self, menuView, toolbar, ide):
        QObject.__init__(self)
        self.__ide = ide

        self.hideConsoleAction = menuView.addAction(
            self.tr("Show/Hide &Console (%s)" %
                resources.get_shortcut("Hide-misc").toString(
                    QKeySequence.NativeText)))
        self.hideConsoleAction.setCheckable(True)
        self.hideEditorAction = menuView.addAction(
            self.tr("Show/Hide &Editor (%s)" %
                resources.get_shortcut("Hide-editor").toString(
                    QKeySequence.NativeText)))
        self.hideEditorAction.setCheckable(True)
        self.hideAllAction = menuView.addAction(
            self.tr("Show/Hide &All (%s)" %
                resources.get_shortcut("Hide-all").toString(
                    QKeySequence.NativeText)))
        self.hideAllAction.setCheckable(True)
        self.hideExplorerAction = menuView.addAction(
            self.tr("Show/Hide &Explorer (%s)" %
                resources.get_shortcut("Hide-explorer").toString(
                    QKeySequence.NativeText)))
        self.hideExplorerAction.setCheckable(True)
        self.hideToolbarAction = menuView.addAction(
            self.tr("Show/Hide &Toolbar"))
        self.hideToolbarAction.setCheckable(True)
        self.fullscreenAction = menuView.addAction(
            QIcon(resources.IMAGES['fullscreen']),
            self.tr("Full Screen &Mode (%s)" %
                resources.get_shortcut("Full-screen").toString(
                    QKeySequence.NativeText)))
        menuView.addSeparator()
        splitTabHAction = menuView.addAction(
            QIcon(resources.IMAGES['splitH']),
            self.tr("Split Tabs Horizontally (%s)" %
                resources.get_shortcut("Split-horizontal").toString(
                    QKeySequence.NativeText)))
        splitTabVAction = menuView.addAction(
            QIcon(resources.IMAGES['splitV']),
            self.tr("Split Tabs Vertically (%s)" %
                resources.get_shortcut("Split-vertical").toString(
                    QKeySequence.NativeText)))
        followModeAction = menuView.addAction(
            QIcon(resources.IMAGES['follow']),
            self.tr("Follow Mode (%s)" %
                resources.get_shortcut("Follow-mode").toString(
                    QKeySequence.NativeText)))
        groupTabsAction = menuView.addAction(self.tr("Group Tabs by Project"))
        deactivateGroupTabsAction = menuView.addAction(
            self.tr("Deactivate Group Tabs"))
        menuView.addSeparator()
        #Zoom
        zoomInAction = menuView.addAction(QIcon(resources.IMAGES['zoom-in']),
            self.tr("Zoom &In (Shift+Wheel-Up)"))
        zoomOutAction = menuView.addAction(QIcon(resources.IMAGES['zoom-out']),
            self.tr("Zoom &Out (Shift+Wheel-Down)"))
        menuView.addSeparator()
        fadeInAction = menuView.addAction(self.tr("Fade In (Alt+Wheel-Up)"))
        fadeOutAction = menuView.addAction(
            self.tr("Fade Out (Alt+Wheel-Down)"))

        self.toolbar_items = {
            'splith': splitTabHAction,
            'splitv': splitTabVAction,
            'follow-mode': followModeAction,
            'zoom-in': zoomInAction,
            'zoom-out': zoomOutAction}

        self.connect(self.hideConsoleAction, SIGNAL("triggered()"),
            self.__ide.actions.view_misc_visibility)
        self.connect(self.hideEditorAction, SIGNAL("triggered()"),
            self.__ide.actions.view_main_visibility)
        self.connect(self.hideExplorerAction, SIGNAL("triggered()"),
            self.__ide.actions.view_explorer_visibility)
        self.connect(self.hideAllAction, SIGNAL("triggered()"),
            self.__ide.actions.hide_all)
        self.connect(self.fullscreenAction, SIGNAL("triggered()"),
            self.__ide.actions.fullscreen_mode)

        self.connect(splitTabHAction, SIGNAL("triggered()"),
            lambda: self.__ide.mainContainer.split_tab(True))
        self.connect(splitTabVAction, SIGNAL("triggered()"),
            lambda: self.__ide.mainContainer.split_tab(False))
        QObject.connect(followModeAction, SIGNAL("triggered()"),
            self.__ide.mainContainer.show_follow_mode)
        self.connect(zoomInAction, SIGNAL("triggered()"),
            self.zoom_in_editor)
        self.connect(zoomOutAction, SIGNAL("triggered()"),
            self.zoom_out_editor)
        self.connect(fadeInAction, SIGNAL("triggered()"), self._fade_in)
        self.connect(fadeOutAction, SIGNAL("triggered()"), self._fade_out)
        self.connect(self.hideToolbarAction, SIGNAL("triggered()"),
            self._hide_show_toolbar)
        self.connect(groupTabsAction, SIGNAL("triggered()"),
            self.__ide.actions.group_tabs_together)
        self.connect(deactivateGroupTabsAction, SIGNAL("triggered()"),
            self.__ide.actions.deactivate_tabs_groups)

        #Set proper MenuView checks values:
        self.hideAllAction.setChecked(True)
        self.hideConsoleAction.setChecked(False)
        self.hideEditorAction.setChecked(True)
        self.hideExplorerAction.setChecked(True)
        self.hideToolbarAction.setChecked(True)
Esempio n. 18
0
    def __init__(self, menuEdit, toolbar):
        QObject.__init__(self)

        undoAction = menuEdit.addAction(QIcon(resources.IMAGES['undo']),
            (self.trUtf8("Undo (%s+Z)") % settings.OS_KEY))
        redoAction = menuEdit.addAction(QIcon(resources.IMAGES['redo']),
            (self.trUtf8("Redo (%s)") % resources.get_shortcut("Redo").toString(
                    QKeySequence.NativeText)))
        cutAction = menuEdit.addAction(QIcon(resources.IMAGES['cut']),
            (self.trUtf8("&Cut (%s+X)") % settings.OS_KEY))
        copyAction = menuEdit.addAction(QIcon(resources.IMAGES['copy']),
            (self.trUtf8("&Copy (%s+C)") % settings.OS_KEY))
        pasteAction = menuEdit.addAction(QIcon(resources.IMAGES['paste']),
            (self.trUtf8("&Paste (%s+V)") % settings.OS_KEY))
        menuEdit.addSeparator()
        findAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
            (self.trUtf8("Find (%s)") % resources.get_shortcut("Find").toString(
                    QKeySequence.NativeText)))
        findReplaceAction = menuEdit.addAction(
            QIcon(resources.IMAGES['findReplace']),
            (self.trUtf8("Find/Replace (%s)") %
                resources.get_shortcut("Find-replace").toString(
                    QKeySequence.NativeText)))
        findWithWordAction = menuEdit.addAction(
            (self.trUtf8("Find using word under cursor (%s)") %
                resources.get_shortcut("Find-with-word").toString(
                    QKeySequence.NativeText)))
        findInFilesAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
            (self.trUtf8("Find in Files (%s)") %
                resources.get_shortcut("Find-in-files").toString(
                    QKeySequence.NativeText)))
        locatorAction = menuEdit.addAction(QIcon(resources.IMAGES['locator']),
            (self.trUtf8("Code Locator (%s)") %
                resources.get_shortcut("Code-locator").toString(
                    QKeySequence.NativeText)))
        menuEdit.addSeparator()
        upperAction = menuEdit.addAction(
            self.trUtf8("Convert selected Text to: UPPER"))
        lowerAction = menuEdit.addAction(
            self.trUtf8("Convert selected Text to: lower"))
        titleAction = menuEdit.addAction(
            self.trUtf8("Convert selected Text to: Title Word"))
        menuEdit.addSeparator()
        prefAction = menuEdit.addAction(QIcon(resources.IMAGES['pref']),
            self.trUtf8("Preference&s"))

        self.toolbar_items = {
            'undo': undoAction,
            'redo': redoAction,
            'cut': cutAction,
            'copy': copyAction,
            'paste': pasteAction,
            'find': findAction,
            'find-replace': findReplaceAction,
            'find-files': findInFilesAction,
            'code-locator': locatorAction}

        self.connect(cutAction, SIGNAL("triggered()"), self._editor_cut)
        self.connect(copyAction, SIGNAL("triggered()"), self._editor_copy)
        self.connect(pasteAction, SIGNAL("triggered()"), self._editor_paste)
        self.connect(redoAction, SIGNAL("triggered()"), self._editor_redo)
        self.connect(undoAction, SIGNAL("triggered()"), self._editor_undo)
        self.connect(upperAction, SIGNAL("triggered()"), self._editor_upper)
        self.connect(lowerAction, SIGNAL("triggered()"), self._editor_lower)
        self.connect(titleAction, SIGNAL("triggered()"), self._editor_title)
        self.connect(findAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show)
        self.connect(findWithWordAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_with_word)
        self.connect(findReplaceAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_replace)
        self.connect(findInFilesAction, SIGNAL("triggered()"),
            self._show_find_in_files)
        self.connect(locatorAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_locator)
        self.connect(prefAction, SIGNAL("triggered()"), self._show_preferences)
    def __init__(self, parent):
        super(EditorCompletion, self).__init__()
        self._preferences = parent
        vbox = QVBoxLayout(self)

        groupBoxClose = QGroupBox(translations.TR_PREF_EDITOR_COMPLETE)
        formClose = QGridLayout(groupBoxClose)
        formClose.setContentsMargins(5, 15, 5, 5)
        self._checkParentheses = QCheckBox(
            translations.TR_PREF_EDITOR_PARENTHESES + " ()")
        self._checkParentheses.setChecked('(' in settings.BRACES)
        self._checkKeys = QCheckBox(translations.TR_PREF_EDITOR_KEYS + " {}")
        self._checkKeys.setChecked('{' in settings.BRACES)
        self._checkBrackets = QCheckBox(translations.TR_PREF_EDITOR_BRACKETS +
                                        " []")
        self._checkBrackets.setChecked('[' in settings.BRACES)
        self._checkSimpleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_SIMPLE_QUOTES)
        self._checkSimpleQuotes.setChecked("'" in settings.QUOTES)
        self._checkDoubleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_DOUBLE_QUOTES)
        self._checkDoubleQuotes.setChecked('"' in settings.QUOTES)
        self._checkCompleteDeclarations = QCheckBox(
            translations.TR_PREF_EDITOR_COMPLETE_DECLARATIONS.format(
                resources.get_shortcut("Complete-Declarations").toString(
                    QKeySequence.NativeText)))
        self._checkCompleteDeclarations.setChecked(
            settings.COMPLETE_DECLARATIONS)
        formClose.addWidget(self._checkParentheses,
                            1,
                            1,
                            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkKeys, 1, 2, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkBrackets, 2, 1, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkSimpleQuotes,
                            2,
                            2,
                            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkDoubleQuotes,
                            3,
                            1,
                            alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxClose)

        groupBoxCode = QGroupBox(translations.TR_PREF_EDITOR_CODE_COMPLETION)
        formCode = QGridLayout(groupBoxCode)
        formCode.setContentsMargins(5, 15, 5, 5)
        self._checkCodeDot = QCheckBox(
            translations.TR_PREF_EDITOR_ACTIVATE_COMPLETION)
        self._checkCodeDot.setChecked(settings.CODE_COMPLETION)
        formCode.addWidget(self._checkCompleteDeclarations,
                           5,
                           1,
                           alignment=Qt.AlignTop)

        formCode.addWidget(self._checkCodeDot, 6, 1, alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxCode)
        vbox.addItem(
            QSpacerItem(0, 10, QSizePolicy.Expanding, QSizePolicy.Expanding))

        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
Esempio n. 20
0
    def __init__(self, menuSource):
        QObject.__init__(self)

        indentMoreAction = menuSource.addAction(
            QIcon(resources.IMAGES['indent-more']),
            (self.trUtf8("Indent More (%s)") %
             QKeySequence(Qt.Key_Tab).toString(QKeySequence.NativeText)))
        indentLessAction = menuSource.addAction(
            QIcon(resources.IMAGES['indent-less']),
            (self.trUtf8("Indent Less (%s)") %
             resources.get_shortcut("Indent-less").toString(
                 QKeySequence.NativeText)))
        menuSource.addSeparator()
        commentAction = menuSource.addAction(
            QIcon(resources.IMAGES['comment-code']),
            (self.trUtf8("Comment (%s)") %
             resources.get_shortcut("Comment").toString(
                 QKeySequence.NativeText)))
        unCommentAction = menuSource.addAction(
            QIcon(resources.IMAGES['uncomment-code']),
            (self.trUtf8("Uncomment (%s)") %
             resources.get_shortcut("Uncomment").toString(
                 QKeySequence.NativeText)))
        horizontalLineAction = menuSource.addAction(
            (self.trUtf8("Insert Horizontal Line (%s)") %
             resources.get_shortcut("Horizontal-line").toString(
                 QKeySequence.NativeText)))
        titleCommentAction = menuSource.addAction(
            (self.trUtf8("Insert Title Comment (%s)") %
             resources.get_shortcut("Title-comment").toString(
                 QKeySequence.NativeText)))
        countCodeLinesAction = menuSource.addAction(
            self.trUtf8("Count Code Lines"))
        menuSource.addSeparator()
        #        tellTaleAction = menuSource.addAction(
        #            self.trUtf8("Tell me a Tale of Code"))
        #        tellTaleAction.setEnabled(False)
        goToDefinitionAction = menuSource.addAction(
            QIcon(resources.IMAGES['go-to-definition']),
            (self.trUtf8("Go To Definition (%s or %s+Click)") %
             (resources.get_shortcut("Go-to-definition").toString(
                 QKeySequence.NativeText), settings.OS_KEY)))
        insertImport = menuSource.addAction(
            QIcon(resources.IMAGES['insert-import']),
            (self.trUtf8("Insert &Import (%s)") %
             resources.get_shortcut("Import").toString(
                 QKeySequence.NativeText)))
        menu_debugging = menuSource.addMenu(self.trUtf8("Debugging Tricks"))
        insertPrints = menu_debugging.addAction(
            self.trUtf8("Insert Prints per selected line."))
        insertPdb = menu_debugging.addAction(
            self.trUtf8("Insert pdb.set_trace()"))
        #        organizeImportsAction = menuSource.addAction(
        #            self.trUtf8("&Organize Imports"))
        #        removeUnusedImportsAction = menuSource.addAction(
        #            self.trUtf8("Remove Unused &Imports"))
        #        extractMethodAction = menuSource.addAction(
        #            self.trUtf8("Extract selected &code as Method"))
        menuSource.addSeparator()
        removeTrailingSpaces = menuSource.addAction(
            self.trUtf8("&Remove Trailing Spaces"))
        replaceTabsSpaces = menuSource.addAction(
            self.trUtf8("Replace Tabs With &Spaces"))
        moveUp = menuSource.addAction(
            (self.trUtf8("Move &Up (%s)") %
             resources.get_shortcut("Move-up").toString(
                 QKeySequence.NativeText)))
        moveDown = menuSource.addAction(
            (self.trUtf8("Move &Down (%s)") %
             resources.get_shortcut("Move-down").toString(
                 QKeySequence.NativeText)))
        duplicate = menuSource.addAction(
            (self.trUtf8("Duplica&te (%s)") %
             resources.get_shortcut("Duplicate").toString(
                 QKeySequence.NativeText)))
        remove = menuSource.addAction(
            (self.trUtf8("&Remove Line (%s)") %
             resources.get_shortcut("Remove-line").toString(
                 QKeySequence.NativeText)))

        self.toolbar_items = {
            'indent-more': indentMoreAction,
            'indent-less': indentLessAction,
            'comment': commentAction,
            'uncomment': unCommentAction,
            'go-to-definition': goToDefinitionAction,
            'insert-import': insertImport
        }

        self.connect(goToDefinitionAction, SIGNAL("triggered()"),
                     actions.Actions().editor_go_to_definition)
        self.connect(countCodeLinesAction, SIGNAL("triggered()"),
                     actions.Actions().count_file_code_lines)
        self.connect(insertImport, SIGNAL("triggered()"),
                     actions.Actions().import_from_everywhere)
        self.connect(indentMoreAction, SIGNAL("triggered()"),
                     actions.Actions().editor_indent_more)
        self.connect(indentLessAction, SIGNAL("triggered()"),
                     actions.Actions().editor_indent_less)
        self.connect(commentAction, SIGNAL("triggered()"),
                     actions.Actions().editor_comment)
        self.connect(unCommentAction, SIGNAL("triggered()"),
                     actions.Actions().editor_uncomment)
        self.connect(horizontalLineAction, SIGNAL("triggered()"),
                     actions.Actions().editor_insert_horizontal_line)
        self.connect(titleCommentAction, SIGNAL("triggered()"),
                     actions.Actions().editor_insert_title_comment)
        #        QObject.connect(removeUnusedImportsAction, SIGNAL("triggered()"),
        #        lambda: self._main._central.obtain_editor().remove_unused_imports())
        ##        QObject.connect(addMissingImportsAction, SIGNAL("triggered()"),
        #        lambda: self._main._central.obtain_editor().add_missing_imports())
        #        QObject.connect(organizeImportsAction, SIGNAL("triggered()"),
        #        lambda: self._main._central.obtain_editor().organize_imports())
        #        QObject.connect(extractMethodAction, SIGNAL("triggered()"),
        #        lambda: self._main._central.obtain_editor().extract_method())
        self.connect(moveUp, SIGNAL("triggered()"),
                     actions.Actions().editor_move_up)
        self.connect(moveDown, SIGNAL("triggered()"),
                     actions.Actions().editor_move_down)
        self.connect(duplicate, SIGNAL("triggered()"),
                     actions.Actions().editor_duplicate)
        self.connect(replaceTabsSpaces, SIGNAL("triggered()"),
                     actions.Actions().editor_replace_tabs_with_spaces)
        self.connect(removeTrailingSpaces, SIGNAL("triggered()"),
                     actions.Actions().editor_remove_trailing_spaces)
        self.connect(remove, SIGNAL("triggered()"),
                     actions.Actions().editor_remove_line)
        self.connect(insertPrints, SIGNAL("triggered()"),
                     actions.Actions().editor_insert_debugging_prints)
        self.connect(insertPdb, SIGNAL("triggered()"),
                     actions.Actions().editor_insert_pdb)
Esempio n. 21
0
    def __init__(self, menuFile, toolbar, ide):
        QObject.__init__(self)

        newAction = menuFile.addAction(QIcon(resources.IMAGES['new']),
            self.tr("&New File (%1)").arg(
                resources.get_shortcut("New-file").toString(
                    QKeySequence.NativeText)))
        newProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['newProj']),
            self.tr("New Pro&ject (%1)").arg(
                resources.get_shortcut("New-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        saveAction = menuFile.addAction(QIcon(resources.IMAGES['save']),
            self.tr("&Save (%1)").arg(
                resources.get_shortcut("Save-file").toString(
                    QKeySequence.NativeText)))
        saveAsAction = menuFile.addAction(QIcon(resources.IMAGES['saveAs']),
            self.tr("Save &As"))
        saveAllAction = menuFile.addAction(QIcon(resources.IMAGES['saveAll']),
            self.tr("Save All"))
        saveProjectAction = menuFile.addAction(QIcon(
            resources.IMAGES['saveAll']),
            self.tr("Save Pro&ject  (%1)").arg(
                resources.get_shortcut("Save-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        reloadFileAction = menuFile.addAction(
            QIcon(resources.IMAGES['reload-file']),
            self.tr("Reload File (%1)").arg(
                resources.get_shortcut("Reload-file").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        openAction = menuFile.addAction(QIcon(resources.IMAGES['open']),
            self.tr("&Open (%1)").arg(
                resources.get_shortcut("Open-file").toString(
                    QKeySequence.NativeText)))
        openProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['openProj']),
            self.tr("Open &Project (%1)").arg(
                resources.get_shortcut("Open-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        activateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['activate-profile']),
            self.tr("Activate Profile"))
        deactivateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['deactivate-profile']),
            self.tr("Deactivate Profile"))
        menuFile.addSeparator()
        printFile = menuFile.addAction(QIcon(resources.IMAGES['print']),
            self.tr("Pr&int File (%1)").arg(
                resources.get_shortcut("Print-file").toString(
                    QKeySequence.NativeText)))
        closeAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Close Tab (%1)").arg(
                resources.get_shortcut("Close-tab").toString(
                    QKeySequence.NativeText)))
        closeProjectsAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Close All Projects"))
        menuFile.addSeparator()
        exitAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Exit"))

        self.toolbar_items = {
            'new-file': newAction,
            'new-project': newProjectAction,
            'save-file': saveAction,
            'save-as': saveAsAction,
            'save-all': saveAllAction,
            'save-project': saveProjectAction,
            'reload-file': reloadFileAction,
            'open-file': openAction,
            'open-project': openProjectAction,
            'activate-profile': activateProfileAction,
            'deactivate-profile': deactivateProfileAction,
            'print-file': printFile,
            'close-file': closeAction,
            'close-projects': closeProjectsAction}

        self.connect(newAction, SIGNAL("triggered()"),
            ide.mainContainer.add_editor)
        self.connect(newProjectAction, SIGNAL("triggered()"),
            ide.explorer.create_new_project)
        self.connect(openAction, SIGNAL("triggered()"),
            ide.mainContainer.open_file)
        self.connect(saveAction, SIGNAL("triggered()"),
            ide.mainContainer.save_file)
        self.connect(saveAsAction, SIGNAL("triggered()"),
            ide.mainContainer.save_file_as)
        self.connect(saveAllAction, SIGNAL("triggered()"),
            ide.actions.save_all)
        self.connect(saveProjectAction, SIGNAL("triggered()"),
            ide.actions.save_project)
        self.connect(openProjectAction, SIGNAL("triggered()"),
            ide.explorer.open_project_folder)
        self.connect(closeAction, SIGNAL("triggered()"),
            ide.mainContainer.actualTab.close_tab)
        self.connect(exitAction, SIGNAL("triggered()"),
            ide.close)
        QObject.connect(reloadFileAction, SIGNAL("triggered()"),
            ide.mainContainer.reload_file)
        self.connect(printFile, SIGNAL("triggered()"), ide.actions.print_file)
        self.connect(closeProjectsAction, SIGNAL("triggered()"),
            ide.explorer.close_opened_projects)
        self.connect(deactivateProfileAction, SIGNAL("triggered()"),
            ide.actions.deactivate_profile)
        self.connect(activateProfileAction, SIGNAL("triggered()"),
            ide.actions.activate_profile)
Esempio n. 22
0
    def __init__(self, menuEdit, toolbar):
        QObject.__init__(self)

        undoAction = menuEdit.addAction(QIcon(resources.IMAGES['undo']),
            self.tr("Undo (%1+Z)").arg(settings.OS_KEY))
        redoAction = menuEdit.addAction(QIcon(resources.IMAGES['redo']),
            self.tr("Redo (%1)").arg(
                resources.get_shortcut("Redo").toString(
                    QKeySequence.NativeText)))
        cutAction = menuEdit.addAction(QIcon(resources.IMAGES['cut']),
            self.tr("&Cut (%1+X)").arg(settings.OS_KEY))
        copyAction = menuEdit.addAction(QIcon(resources.IMAGES['copy']),
            self.tr("&Copy (%1+C)").arg(settings.OS_KEY))
        pasteAction = menuEdit.addAction(QIcon(resources.IMAGES['paste']),
            self.tr("&Paste (%1+V)").arg(settings.OS_KEY))
        menuEdit.addSeparator()
        findAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
            self.tr("Find (%1)").arg(
                resources.get_shortcut("Find").toString(
                    QKeySequence.NativeText)))
        findReplaceAction = menuEdit.addAction(
            QIcon(resources.IMAGES['findReplace']),
            self.tr("Find/Replace (%1)").arg(
                resources.get_shortcut("Find-replace").toString(
                    QKeySequence.NativeText)))
        findWithWordAction = menuEdit.addAction(
            self.tr("Find using word under cursor (%1)").arg(
                resources.get_shortcut("Find-with-word").toString(
                    QKeySequence.NativeText)))
        findInFilesAction = menuEdit.addAction(QIcon(resources.IMAGES['find']),
            self.tr("Find in Files (%1)").arg(
                resources.get_shortcut("Find-in-files").toString(
                    QKeySequence.NativeText)))
        locatorAction = menuEdit.addAction(QIcon(resources.IMAGES['locator']),
            self.tr("Code Locator (%1)").arg(
                resources.get_shortcut("Code-locator").toString(
                    QKeySequence.NativeText)))
        menuEdit.addSeparator()
        upperAction = menuEdit.addAction(
            self.tr("Convert selected Text to: UPPER"))
        lowerAction = menuEdit.addAction(
            self.tr("Convert selected Text to: lower"))
        titleAction = menuEdit.addAction(
            self.tr("Convert selected Text to: Title Word"))
        menuEdit.addSeparator()
        prefAction = menuEdit.addAction(QIcon(resources.IMAGES['pref']),
            self.tr("Preference&s"))

        self.toolbar_items = {
            'undo': undoAction,
            'redo': redoAction,
            'cut': cutAction,
            'copy': copyAction,
            'paste': pasteAction,
            'find': findAction,
            'find-replace': findReplaceAction,
            'find-files': findInFilesAction,
            'code-locator': locatorAction}

        self.connect(cutAction, SIGNAL("triggered()"), self._editor_cut)
        self.connect(copyAction, SIGNAL("triggered()"), self._editor_copy)
        self.connect(pasteAction, SIGNAL("triggered()"), self._editor_paste)
        self.connect(redoAction, SIGNAL("triggered()"), self._editor_redo)
        self.connect(undoAction, SIGNAL("triggered()"), self._editor_undo)
        self.connect(upperAction, SIGNAL("triggered()"), self._editor_upper)
        self.connect(lowerAction, SIGNAL("triggered()"), self._editor_lower)
        self.connect(titleAction, SIGNAL("triggered()"), self._editor_title)
        self.connect(findAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show)
        self.connect(findWithWordAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_with_word)
        self.connect(findReplaceAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_replace)
        self.connect(findInFilesAction, SIGNAL("triggered()"),
            self._show_find_in_files)
        self.connect(locatorAction, SIGNAL("triggered()"),
            status_bar.StatusBar().show_locator)
        self.connect(prefAction, SIGNAL("triggered()"), self._show_preferences)
Esempio n. 23
0
    def __init__(self, menuView, toolbar, ide):
        QObject.__init__(self)
        self.__ide = ide

        self.hideConsoleAction = menuView.addAction(
            self.trUtf8("Show/Hide &Console (%s)" %
                        resources.get_shortcut("Hide-misc").toString(
                            QKeySequence.NativeText)))
        self.hideConsoleAction.setCheckable(True)
        self.hideEditorAction = menuView.addAction(
            self.trUtf8("Show/Hide &Editor (%s)" %
                        resources.get_shortcut("Hide-editor").toString(
                            QKeySequence.NativeText)))
        self.hideEditorAction.setCheckable(True)
        self.hideAllAction = menuView.addAction(
            self.trUtf8("Show/Hide &All (%s)" %
                        resources.get_shortcut("Hide-all").toString(
                            QKeySequence.NativeText)))
        self.hideAllAction.setCheckable(True)
        self.hideExplorerAction = menuView.addAction(
            self.trUtf8("Show/Hide &Explorer (%s)" %
                        resources.get_shortcut("Hide-explorer").toString(
                            QKeySequence.NativeText)))
        self.hideExplorerAction.setCheckable(True)
        self.hideToolbarAction = menuView.addAction(
            self.trUtf8("Show/Hide &Toolbar"))
        self.hideToolbarAction.setCheckable(True)
        self.fullscreenAction = menuView.addAction(
            QIcon(resources.IMAGES['fullscreen']),
            self.trUtf8("Full Screen &Mode (%s)" %
                        resources.get_shortcut("Full-screen").toString(
                            QKeySequence.NativeText)))
        menuView.addSeparator()
        splitTabHAction = menuView.addAction(
            QIcon(resources.IMAGES['splitH']),
            self.trUtf8("Split Tabs Horizontally (%s)" %
                        resources.get_shortcut("Split-horizontal").toString(
                            QKeySequence.NativeText)))
        splitTabVAction = menuView.addAction(
            QIcon(resources.IMAGES['splitV']),
            self.trUtf8("Split Tabs Vertically (%s)" %
                        resources.get_shortcut("Split-vertical").toString(
                            QKeySequence.NativeText)))
        followModeAction = menuView.addAction(
            QIcon(resources.IMAGES['follow']),
            self.trUtf8("Follow Mode (%s)" %
                        resources.get_shortcut("Follow-mode").toString(
                            QKeySequence.NativeText)))
        groupTabsAction = menuView.addAction(
            self.trUtf8("Group Tabs by Project"))
        deactivateGroupTabsAction = menuView.addAction(
            self.trUtf8("Deactivate Group Tabs"))
        menuView.addSeparator()
        #Zoom
        zoomInAction = menuView.addAction(
            QIcon(resources.IMAGES['zoom-in']),
            self.trUtf8("Zoom &In (Shift+Wheel-Up)"))
        zoomOutAction = menuView.addAction(
            QIcon(resources.IMAGES['zoom-out']),
            self.trUtf8("Zoom &Out (Shift+Wheel-Down)"))
        menuView.addSeparator()
        fadeInAction = menuView.addAction(
            self.trUtf8("Fade In (Alt+Wheel-Up)"))
        fadeOutAction = menuView.addAction(
            self.trUtf8("Fade Out (Alt+Wheel-Down)"))

        self.toolbar_items = {
            'splith': splitTabHAction,
            'splitv': splitTabVAction,
            'follow-mode': followModeAction,
            'zoom-in': zoomInAction,
            'zoom-out': zoomOutAction
        }

        self.connect(self.hideConsoleAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_misc_visibility)
        self.connect(self.hideEditorAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_main_visibility)
        self.connect(self.hideExplorerAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_explorer_visibility)
        self.connect(self.hideAllAction, SIGNAL("triggered()"),
                     self.__ide.actions.hide_all)
        self.connect(self.fullscreenAction, SIGNAL("triggered()"),
                     self.__ide.actions.fullscreen_mode)

        self.connect(splitTabHAction, SIGNAL("triggered()"),
                     lambda: self.__ide.mainContainer.split_tab(True))
        self.connect(splitTabVAction, SIGNAL("triggered()"),
                     lambda: self.__ide.mainContainer.split_tab(False))
        QObject.connect(followModeAction, SIGNAL("triggered()"),
                        self.__ide.mainContainer.show_follow_mode)
        self.connect(zoomInAction, SIGNAL("triggered()"), self.zoom_in_editor)
        self.connect(zoomOutAction, SIGNAL("triggered()"),
                     self.zoom_out_editor)
        self.connect(fadeInAction, SIGNAL("triggered()"), self._fade_in)
        self.connect(fadeOutAction, SIGNAL("triggered()"), self._fade_out)
        self.connect(self.hideToolbarAction, SIGNAL("triggered()"),
                     self._hide_show_toolbar)
        self.connect(groupTabsAction, SIGNAL("triggered()"),
                     self.__ide.actions.group_tabs_together)
        self.connect(deactivateGroupTabsAction, SIGNAL("triggered()"),
                     self.__ide.actions.deactivate_tabs_groups)

        #Set proper MenuView checks values:
        self.hideAllAction.setChecked(True)
        self.hideConsoleAction.setChecked(False)
        self.hideEditorAction.setChecked(True)
        self.hideExplorerAction.setChecked(True)
        self.hideToolbarAction.setChecked(True)
Esempio n. 24
0
    def __init__(self, menuFile, toolbar, ide):
        super(MenuFile, self).__init__()

        newAction = menuFile.addAction(QIcon(resources.IMAGES['new']),
            (_translate("MenuFile", "&New File (%s)") %
                resources.get_shortcut("New-file").toString(
                    QKeySequence.NativeText)))
        newProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['newProj']),
            (_translate("MenuFile", "New Pro&ject (%s)") %
                resources.get_shortcut("New-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        saveAction = menuFile.addAction(QIcon(resources.IMAGES['save']),
            (_translate("MenuFile", "&Save (%s)") %
                resources.get_shortcut("Save-file").toString(
                    QKeySequence.NativeText)))
        saveAsAction = menuFile.addAction(QIcon(resources.IMAGES['saveAs']),
            _translate("MenuFile", "Save &As"))
        saveAllAction = menuFile.addAction(QIcon(resources.IMAGES['saveAll']),
            _translate("MenuFile", "Save All"))
        saveProjectAction = menuFile.addAction(QIcon(
            resources.IMAGES['saveAll']),
            (_translate("MenuFile", "Save Pro&ject  (%s)") %
                resources.get_shortcut("Save-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        reloadFileAction = menuFile.addAction(
            QIcon(resources.IMAGES['reload-file']),
            (_translate("MenuFile", "Reload File (%s)") %
                resources.get_shortcut("Reload-file").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        openAction = menuFile.addAction(QIcon(resources.IMAGES['open']),
            (_translate("MenuFile", "&Open (%s)") %
                resources.get_shortcut("Open-file").toString(
                    QKeySequence.NativeText)))
        openProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['openProj']),
            (_translate("MenuFile", "Open &Project (%s)") %
                resources.get_shortcut("Open-project").toString(
                    QKeySequence.NativeText)))
        self.recent_files = menuFile.addMenu(_translate("MenuFile", 'Open Recent Files'))
        menuFile.addSeparator()
        activateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['activate-profile']),
            _translate("MenuFile", "Activate Profile"))
        deactivateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['deactivate-profile']),
            _translate("MenuFile", "Deactivate Profile"))
        menuFile.addSeparator()
        printFile = menuFile.addAction(QIcon(resources.IMAGES['print']),
            (_translate("MenuFile", "Pr&int File (%s)") %
                resources.get_shortcut("Print-file").toString(
                    QKeySequence.NativeText)))
        closeAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            (_translate("MenuFile", "&Close Tab (%s)") %
                resources.get_shortcut("Close-tab").toString(
                    QKeySequence.NativeText)))
        closeProjectsAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            _translate("MenuFile", "&Close All Projects"))
        menuFile.addSeparator()
        exitAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            _translate("MenuFile", "&Exit"))

        self.toolbar_items = {
            'new-file': newAction,
            'new-project': newProjectAction,
            'save-file': saveAction,
            'save-as': saveAsAction,
            'save-all': saveAllAction,
            'save-project': saveProjectAction,
            'reload-file': reloadFileAction,
            'open-file': openAction,
            'open-project': openProjectAction,
            'activate-profile': activateProfileAction,
            'deactivate-profile': deactivateProfileAction,
            'print-file': printFile,
            'close-file': closeAction,
            'close-projects': closeProjectsAction}

        newAction.triggered['bool'].connect(lambda: ide.mainContainer.add_editor())
        newProjectAction.triggered['bool'].connect(lambda: ide.explorer.create_new_project())
        openAction.triggered['bool'].connect(lambda: ide.mainContainer.open_file())
        saveAction.triggered['bool'].connect(lambda: ide.mainContainer.save_file())
        saveAsAction.triggered['bool'].connect(lambda: ide.mainContainer.save_file_as())
        saveAllAction.triggered['bool'].connect(lambda: ide.actions.save_all())
        saveProjectAction.triggered['bool'].connect(lambda: ide.actions.save_project())
        openProjectAction.triggered['bool'].connect(lambda: ide.explorer.open_project_folder())
        closeAction.triggered['bool'].connect(lambda: ide.mainContainer.actualTab.close_tab())
        exitAction.triggered['bool'].connect(lambda: ide.close())
        reloadFileAction.triggered['bool'].connect(lambda: ide.mainContainer.reload_file())
        printFile.triggered['bool'].connect(lambda: ide.actions.print_file())
        closeProjectsAction.triggered['bool'].connect(lambda: ide.explorer.close_opened_projects())
        deactivateProfileAction.triggered['bool'].connect(lambda: ide.actions.deactivate_profile())
        activateProfileAction.triggered['bool'].connect(lambda: ide.actions.activate_profile())
        self.recent_files.triggered['QAction*'].connect(self._open_file)