Example #1
0
    def toggle_tabs_and_spaces(self):
        """ Toggle Show/Hide Tabs and Spaces """

        settings.SHOW_TABS_AND_SPACES = not settings.SHOW_TABS_AND_SPACES
        qsettings = IDE.ninja_settings()
        qsettings.setValue('preferences/editor/showTabsAndSpaces',
                           settings.SHOW_TABS_AND_SPACES)
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.TOOLBAR_ITEMS = self.toolbar_settings
     lang = self._comboLang.currentText()
     #preferences/interface
     qsettings.setValue('preferences/interface/showProjectExplorer',
                        self._checkProjectExplorer.isChecked())
     settings.SHOW_PROJECT_EXPLORER = self._checkProjectExplorer.isChecked()
     qsettings.setValue('preferences/interface/showSymbolsList',
                        self._checkSymbols.isChecked())
     settings.SHOW_SYMBOLS_LIST = self._checkSymbols.isChecked()
     qsettings.setValue('preferences/interface/showWebInspector',
                        self._checkWebInspetor.isChecked())
     settings.SHOW_WEB_INSPECTOR = self._checkWebInspetor.isChecked()
     qsettings.setValue('preferences/interface/showErrorsList',
                        self._checkFileErrors.isChecked())
     settings.SHOW_ERRORS_LIST = self._checkFileErrors.isChecked()
     qsettings.setValue('preferences/interface/showMigrationList',
                        self._checkMigrationTips.isChecked())
     settings.SHOW_MIGRATION_LIST = self._checkMigrationTips.isChecked()
     #qsettings.setValue('preferences/interface/toolbar',
                        #settings.TOOLBAR_ITEMS)
     qsettings.setValue('preferences/interface/language', lang)
     lang = lang + '.qm'
     settings.LANGUAGE = os.path.join(resources.LANGS, lang)
Example #3
0
    def activate_plugin(self, plugin):
        """
        Receives PluginMetadata instance and activates its given plugin
        BEWARE: We do not do any kind of checking about if the plugin is
        actually installed.
        """
        qsettings = IDE.ninja_settings()
        activated = qsettings.value('plugins/registry/activated', [])
        failure = qsettings.value('plugins/registry/failure', [])

        plugin_name = plugin.name
        try:
            plugin.activate()
        except Exception:
            #This plugin can no longer be activated
            if plugin.name in activated:
                activated.remove(plugin_name)
            if plugin.name not in failure:
                failure.append(plugin_name)
        else:
            activated.append(plugin_name)
            if plugin_name in failure:
                failure.remove(plugin_name)
        finally:
            qsettings.setValue('plugins/registry/activated', activated)
            qsettings.setValue('plugins/registry/failure', failure)
Example #4
0
    def activate_plugin(self, plugin):
        """
        Receives PluginMetadata instance and activates its given plugin
        BEWARE: We do not do any kind of checking about if the plugin is
        actually installed.
        """
        qsettings = IDE.ninja_settings()
        activated = qsettings.value('plugins/registry/activated', [])
        failure = qsettings.value('plugins/registry/failure', [])

        plugin_name = plugin.name
        try:
            plugin.activate()
        except Exception:
            #This plugin can no longer be activated
            if plugin.name in activated:
                activated.remove(plugin_name)
            if plugin.name not in failure:
                failure.append(plugin_name)
        else:
            activated.append(plugin_name)
            if plugin_name in failure:
                failure.remove(plugin_name)
        finally:
            qsettings.setValue('plugins/registry/activated', activated)
            qsettings.setValue('plugins/registry/failure', failure)
Example #5
0
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.TOOLBAR_ITEMS = self.toolbar_settings
     lang = self._comboLang.currentText()
     #preferences/interface
     qsettings.setValue('preferences/interface/showProjectExplorer',
                        self._checkProjectExplorer.isChecked())
     settings.SHOW_PROJECT_EXPLORER = self._checkProjectExplorer.isChecked()
     qsettings.setValue('preferences/interface/showSymbolsList',
                        self._checkSymbols.isChecked())
     settings.SHOW_SYMBOLS_LIST = self._checkSymbols.isChecked()
     qsettings.setValue('preferences/interface/showWebInspector',
                        self._checkWebInspetor.isChecked())
     settings.SHOW_WEB_INSPECTOR = self._checkWebInspetor.isChecked()
     qsettings.setValue('preferences/interface/showErrorsList',
                        self._checkFileErrors.isChecked())
     settings.SHOW_ERRORS_LIST = self._checkFileErrors.isChecked()
     qsettings.setValue('preferences/interface/showMigrationList',
                        self._checkMigrationTips.isChecked())
     settings.SHOW_MIGRATION_LIST = self._checkMigrationTips.isChecked()
     #qsettings.setValue('preferences/interface/toolbar',
     #settings.TOOLBAR_ITEMS)
     qsettings.setValue('preferences/interface/language', lang)
     lang = lang + '.qm'
     settings.LANGUAGE = os.path.join(resources.LANGS, lang)
Example #6
0
    def save(self):
        """Save all Execution Preferences"""

        qsettings = IDE.ninja_settings()
        qsettings.beginGroup("execution")

        # Python executable
        settings.PYTHON_EXEC = self._combo_python_path.currentText()
        qsettings.setValue("pythonExec", settings.PYTHON_EXEC)

        # Execution options
        options = ""
        if self._check_B.isChecked():
            options += " -B"
        if self._check_d.isChecked():
            options += " -d"
        if self._check_E.isChecked():
            options += " -E"
        if self._check_O.isChecked():
            options += " -O"
        if self._check_OO.isChecked():
            options += " -OO"
        if self._check_s.isChecked():
            options += " -s"
        if self._check_S.isChecked():
            options += " -S"
        if self._check_v.isChecked():
            options += " -v"
        if self._check_W.isChecked():
            options += " -W" + self._combo_warning.currentText()
        settings.EXECUTION_OPTIONS = options
        qsettings.setValue("executionOptions", options)

        qsettings.endGroup()
Example #7
0
    def toggle_tabs_and_spaces(self):
        """ Toggle Show/Hide Tabs and Spaces """

        settings.SHOW_TABS_AND_SPACES = not settings.SHOW_TABS_AND_SPACES
        qsettings = IDE.ninja_settings()
        qsettings.setValue('preferences/editor/showTabsAndSpaces',
                           settings.SHOW_TABS_AND_SPACES)
    def save_scheme(self):
        """Save current scheme."""
        name = self.line_name.text().strip()
        if not self._is_valid_scheme_name(name):
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_SCHEME_INVALID_NAME)
            return
        fileName = ('{0}.color'.format(
            file_manager.create_path(resources.EDITOR_SKINS, name)))
        answer = True
        if file_manager.file_exists(fileName):
            answer = QMessageBox.question(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_WANT_OVERWRITE_FILE +
                ": {0}?".format(fileName), QMessageBox.Yes, QMessageBox.No)

        if answer in (QMessageBox.Yes, True):
            scheme = self._preview_style()
            self.original_style = copy.copy(scheme)
            json_manager.save_editor_skins(fileName, scheme)
            self._modified = False
            self.saved = True
            qsettings = IDE.ninja_settings()
            qsettings.setValue('preferences/editor/scheme', name)
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_SCHEME_SAVED + ": {0}.".format(fileName))
            self.close()
        elif answer == QMessageBox.Yes:
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_INVALID_FILENAME)
Example #9
0
    def _save(self):
        qsettings = IDE.ninja_settings()
        editor_settings = IDE.editor_settings()

        qsettings.beginGroup("editor")
        editor_settings.beginGroup("editor")
        qsettings.beginGroup("behavior")
        editor_settings.beginGroup("behavior")

        settings.REMOVE_TRAILING_SPACES = self._check_remove_spaces.isChecked()
        qsettings.setValue("removeTrailingSpaces",
                           settings.REMOVE_TRAILING_SPACES)
        settings.ADD_NEW_LINE_AT_EOF = self._check_add_new_line.isChecked()
        qsettings.setValue("addNewLineAtEnd", settings.ADD_NEW_LINE_AT_EOF)
        settings.HIDE_MOUSE_CURSOR = self._check_hide_cursor.isChecked()
        qsettings.setValue("hideMouseCursor", settings.HIDE_MOUSE_CURSOR)
        settings.SCROLL_WHEEL_ZOMMING = self._check_scroll_wheel.isChecked()
        qsettings.setValue("scrollWheelZomming", settings.SCROLL_WHEEL_ZOMMING)

        settings.USE_TABS = bool(self._combo_tab_policy.currentIndex())
        editor_settings.setValue("use_tabs", settings.USE_TABS)
        settings.INDENT = self._spin_indent_size.value()
        editor_settings.setValue("indentation_width", settings.INDENT)

        qsettings.endGroup()
        qsettings.endGroup()
        editor_settings.endGroup()
        editor_settings.endGroup()
Example #10
0
 def save(self):
     """Method to Save all preferences values"""
     qsettings = IDE.ninja_settings()
     qsettings.setValue('preferences/general/loadFiles',
                        self._checkLastSession.isChecked())
     qsettings.setValue('preferences/general/activatePlugins',
                        self._checkActivatePlugins.isChecked())
     qsettings.setValue('preferences/general/notifyUpdates',
                        self._checkNotifyUpdates.isChecked())
     qsettings.setValue('preferences/general/showStartPage',
                        self._checkShowStartPage.isChecked())
     qsettings.setValue('preferences/general/confirmExit',
                        self._checkConfirmExit.isChecked())
     settings.CONFIRM_EXIT = self._checkConfirmExit.isChecked()
     qsettings.setValue('preferences/general/workspace',
                        self._txtWorkspace.text())
     settings.WORKSPACE = self._txtWorkspace.text()
     extensions = str(self._txtExtensions.text()).split(',')
     extensions = [e.strip() for e in extensions]
     qsettings.setValue('preferences/general/supportedExtensions',
                        extensions)
     settings.SUPPORTED_EXTENSIONS = list(extensions)
     settings.NOTIFICATION_POSITION = self._notify_position.currentIndex()
     qsettings.setValue('preferences/general/notification_position',
                        settings.NOTIFICATION_POSITION)
     settings.NOTIFICATION_COLOR = self._notification_choosed_color
     qsettings.setValue('preferences/general/notification_color',
                        settings.NOTIFICATION_COLOR)
    def save_scheme(self):
        name = self.line_name.text().strip()
        if not self._is_valid_scheme_name(name):
            QMessageBox.information(self, self.tr("Invalid Scheme Name"),
                self.tr("The scheme name you have chosen is invalid.\nPlease "
                    "pick a different name."))
            return
        fileName = ('{0}.color'.format(
            file_manager.create_path(resources.EDITOR_SKINS, name)))
        answer = True
        if file_manager.file_exists(fileName):
            answer = QMessageBox.question(self,
                self.tr("Scheme already exists"),
                (self.tr("Do you want to override the file: %s?") % fileName),
                QMessageBox.Yes, QMessageBox.No)

        if answer in (QMessageBox.Yes, True):
            scheme = self._preview_style()
            self.original_style = copy.copy(scheme)
            json_manager.save_editor_skins(fileName, scheme)
            self._modified = False
            self.saved = True
            qsettings = IDE.ninja_settings()
            qsettings.setValue('preferences/editor/scheme', name)
            QMessageBox.information(self, self.tr("Scheme Saved"),
                    (self.tr("The scheme has been saved at: %s.") % fileName))
            self.close()
        elif answer == QMessageBox.Yes:
            QMessageBox.information(self, self.tr("Scheme Not Saved"),
                self.tr("The name probably is invalid."))
    def save(self):
        qsettings = IDE.ninja_settings()

        qsettings.beginGroup("ide")
        qsettings.beginGroup("interface")

        ninja_theme = self._combobox_themes.currentText()
        settings.NINJA_SKIN = ninja_theme
        qsettings.setValue("skin", settings.NINJA_SKIN)
        settings.SHOW_PROJECT_EXPLORER = self._checkProjectExplorer.isChecked()
        qsettings.setValue("showProjectExplorer",
                           settings.SHOW_PROJECT_EXPLORER)
        settings.SHOW_SYMBOLS_LIST = self._checkSymbols.isChecked()
        qsettings.setValue("showSymbolsList", settings.SHOW_SYMBOLS_LIST)
        if self._line_custom_hdpi.isEnabled():
            screen_resolution = self._line_custom_hdpi.text().strip()
            settings.CUSTOM_SCREEN_RESOLUTION = screen_resolution
        else:
            settings.HDPI = bool(self._combo_resolution.currentIndex())
            qsettings.setValue("autoHdpi", settings.HDPI)
            settings.CUSTOM_SCREEN_RESOLUTION = ""
        qsettings.setValue("customScreenResolution",
                           settings.CUSTOM_SCREEN_RESOLUTION)

        qsettings.endGroup()
        qsettings.endGroup()
    def _save(self):
        qsettings = IDE.ninja_settings()
        editor_settings = IDE.editor_settings()

        qsettings.beginGroup("editor")
        editor_settings.beginGroup("editor")
        qsettings.beginGroup("behavior")
        editor_settings.beginGroup("behavior")

        settings.REMOVE_TRAILING_SPACES = self._check_remove_spaces.isChecked()
        qsettings.setValue("removeTrailingSpaces",
                           settings.REMOVE_TRAILING_SPACES)
        settings.ADD_NEW_LINE_AT_EOF = self._check_add_new_line.isChecked()
        qsettings.setValue("addNewLineAtEnd", settings.ADD_NEW_LINE_AT_EOF)
        settings.HIDE_MOUSE_CURSOR = self._check_hide_cursor.isChecked()
        qsettings.setValue("hideMouseCursor", settings.HIDE_MOUSE_CURSOR)
        settings.SCROLL_WHEEL_ZOMMING = self._check_scroll_wheel.isChecked()
        qsettings.setValue("scrollWheelZomming", settings.SCROLL_WHEEL_ZOMMING)

        settings.USE_TABS = bool(self._combo_tab_policy.currentIndex())
        editor_settings.setValue("use_tabs", settings.USE_TABS)
        settings.INDENT = self._spin_indent_size.value()
        editor_settings.setValue("indentation_width", settings.INDENT)

        qsettings.endGroup()
        qsettings.endGroup()
        editor_settings.endGroup()
        editor_settings.endGroup()
Example #14
0
 def showEvent(self, event):
     #Show Event
     super(CentralWidget, self).showEvent(event)
     if bin(settings.UI_LAYOUT)[-1] == '1':
         self.splitter_base_rotate()
     if bin(settings.UI_LAYOUT >> 1)[-1] == '1':
         self.splitter_inside_rotate()
     if bin(settings.UI_LAYOUT >> 2)[-1] == '1':
         self.splitter_base_orientation()
     #Rearrange widgets on Window
     qsettings = IDE.ninja_settings()
     #Lists of sizes as list of QVariant- heightList = [QVariant, QVariant]
     heightSize = qsettings.value("window/central/insideSplitterSize", None)
     widthSize = qsettings.value("window/central/baseSplitterSize", None)
     lateralVisible = qsettings.value("window/central/lateralVisible", True,
         type=bool)
     if heightSize is None:
         self._splitterInside.setSizes([(self.height() / 3) * 2,
                                      self.height() / 3])
     else:
         self._splitterInside.restoreState(heightSize)
     if widthSize is None:
         self._splitterBase.setSizes([900, 100])
     else:
         self._splitterBase.restoreState(widthSize)
     if not lateralVisible:
         self.lateralPanel.hide()
    def save_scheme(self):
        """Save current scheme."""
        name = self.line_name.text().strip()
        if not self._is_valid_scheme_name(name):
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_SCHEME_INVALID_NAME)
            return
        fileName = ('{0}.color'.format(
            file_manager.create_path(resources.EDITOR_SKINS, name)))
        answer = True
        if file_manager.file_exists(fileName):
            answer = QMessageBox.question(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_WANT_OVERWRITE_FILE + ": {0}?".format(fileName),
                QMessageBox.Yes, QMessageBox.No)

        if answer in (QMessageBox.Yes, True):
            scheme = self._preview_style()
            self.original_style = copy.copy(scheme)
            json_manager.save_editor_skins(fileName, scheme)
            self._modified = False
            self.saved = True
            qsettings = IDE.ninja_settings()
            qsettings.setValue('preferences/editor/scheme', name)
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_SCHEME_SAVED + ": {0}.".format(fileName))
            self.close()
        elif answer == QMessageBox.Yes:
            QMessageBox.information(
                self, translations.TR_PREFERENCES_EDITOR_SCHEME_DESIGNER,
                translations.TR_INVALID_FILENAME)
    def save(self):
        qsettings = IDE.ninja_settings()

        qsettings.beginGroup("ide")
        qsettings.beginGroup("interface")

        ninja_theme = self._combobox_themes.currentText()
        settings.NINJA_SKIN = ninja_theme
        qsettings.setValue("skin", settings.NINJA_SKIN)
        settings.SHOW_PROJECT_EXPLORER = self._checkProjectExplorer.isChecked()
        qsettings.setValue("showProjectExplorer",
                           settings.SHOW_PROJECT_EXPLORER)
        settings.SHOW_SYMBOLS_LIST = self._checkSymbols.isChecked()
        qsettings.setValue("showSymbolsList", settings.SHOW_SYMBOLS_LIST)
        if self._line_custom_hdpi.isEnabled():
            screen_resolution = self._line_custom_hdpi.text().strip()
            settings.CUSTOM_SCREEN_RESOLUTION = screen_resolution
        else:
            settings.HDPI = bool(self._combo_resolution.currentIndex())
            qsettings.setValue("autoHdpi", settings.HDPI)
            settings.CUSTOM_SCREEN_RESOLUTION = ""
        qsettings.setValue("customScreenResolution",
                           settings.CUSTOM_SCREEN_RESOLUTION)

        qsettings.endGroup()
        qsettings.endGroup()
Example #17
0
    def save_scheme(self):
        name = self.line_name.text().strip()
        if not self._is_valid_scheme_name(name):
            QMessageBox.information(
                self, self.tr("Invalid Scheme Name"),
                self.tr("The scheme name you have chosen is invalid.\nPlease "
                        "pick a different name."))
            return
        fileName = ('{0}.color'.format(
            file_manager.create_path(resources.EDITOR_SKINS, name)))
        answer = True
        if file_manager.file_exists(fileName):
            answer = QMessageBox.question(
                self, self.tr("Scheme already exists"),
                (self.tr("Do you want to override the file: %s?") % fileName),
                QMessageBox.Yes, QMessageBox.No)

        if answer in (QMessageBox.Yes, True):
            scheme = self._preview_style()
            self.original_style = copy.copy(scheme)
            json_manager.save_editor_skins(fileName, scheme)
            self._modified = False
            self.saved = True
            qsettings = IDE.ninja_settings()
            qsettings.setValue('preferences/editor/scheme', name)
            QMessageBox.information(
                self, self.tr("Scheme Saved"),
                (self.tr("The scheme has been saved at: %s.") % fileName))
            self.close()
        elif answer == QMessageBox.Yes:
            QMessageBox.information(self, self.tr("Scheme Not Saved"),
                                    self.tr("The name probably is invalid."))
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.SHOW_MINIMAP = self._checkShowMinimap.isChecked()
     settings.MINIMAP_MAX_OPACITY = self._spinMaxOpacity.value() / 100.0
     settings.MINIMAP_MIN_OPACITY = self._spinMinOpacity.value() / 100.0
     settings.SIZE_PROPORTION = self._spinSize.value() / 100.0
     qsettings.setValue('preferences/editor/minimapShow',
                        settings.SHOW_MINIMAP)
     qsettings.setValue('preferences/editor/minimapMaxOpacity',
                        settings.MINIMAP_MAX_OPACITY)
     qsettings.setValue('preferences/editor/minimapMinOpacity',
                        settings.MINIMAP_MIN_OPACITY)
     qsettings.setValue('preferences/editor/minimapSizeProportion',
                        settings.SIZE_PROPORTION)
     fontText = self._btnEditorFont.text().replace(' ', '')
     settings.FONT_FAMILY = fontText.split(',')[0]
     settings.FONT_SIZE = int(fontText.split(',')[1])
     qsettings.setValue('preferences/editor/fontFamily',
                        settings.FONT_FAMILY)
     qsettings.setValue('preferences/editor/fontSize', settings.FONT_SIZE)
     scheme = self._listScheme.currentItem().text()
     self.original_style = resources.CUSTOM_SCHEME
     qsettings.setValue('preferences/editor/scheme', scheme)
     resources.CUSTOM_SCHEME = self._schemes.get(scheme,
                                                 resources.COLOR_SCHEME)
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.SHOW_MINIMAP = self._checkShowMinimap.isChecked()
     settings.MINIMAP_MAX_OPACITY = self._spinMaxOpacity.value() / 100.0
     settings.MINIMAP_MIN_OPACITY = self._spinMinOpacity.value() / 100.0
     settings.SIZE_PROPORTION = self._spinSize.value() / 100.0
     qsettings.setValue('preferences/editor/minimapShow',
         settings.SHOW_MINIMAP)
     qsettings.setValue('preferences/editor/minimapMaxOpacity',
         settings.MINIMAP_MAX_OPACITY)
     qsettings.setValue('preferences/editor/minimapMinOpacity',
         settings.MINIMAP_MIN_OPACITY)
     qsettings.setValue('preferences/editor/minimapSizeProportion',
         settings.SIZE_PROPORTION)
     fontText = self._btnEditorFont.text().replace(' ', '')
     settings.FONT_FAMILY = fontText.split(',')[0]
     settings.FONT_SIZE = int(fontText.split(',')[1])
     qsettings.setValue('preferences/editor/fontFamily',
         settings.FONT_FAMILY)
     qsettings.setValue('preferences/editor/fontSize', settings.FONT_SIZE)
     scheme = self._listScheme.currentItem().text()
     self.original_style = resources.CUSTOM_SCHEME
     qsettings.setValue('preferences/editor/scheme', scheme)
     resources.CUSTOM_SCHEME = self._schemes.get(scheme,
         resources.COLOR_SCHEME)
Example #20
0
 def save(self):
     """Method to Save all preferences values"""
     qsettings = IDE.ninja_settings()
     qsettings.setValue('preferences/general/loadFiles',
                        self._checkLastSession.isChecked())
     qsettings.setValue('preferences/general/activatePlugins',
                        self._checkActivatePlugins.isChecked())
     qsettings.setValue('preferences/general/notifyUpdates',
                        self._checkNotifyUpdates.isChecked())
     qsettings.setValue('preferences/general/showStartPage',
                        self._checkShowStartPage.isChecked())
     qsettings.setValue('preferences/general/confirmExit',
                        self._checkConfirmExit.isChecked())
     settings.CONFIRM_EXIT = self._checkConfirmExit.isChecked()
     qsettings.setValue('preferences/general/workspace',
                        self._txtWorkspace.text())
     settings.WORKSPACE = self._txtWorkspace.text()
     extensions = str(self._txtExtensions.text()).split(',')
     extensions = [e.strip() for e in extensions]
     qsettings.setValue('preferences/general/supportedExtensions',
                        extensions)
     settings.SUPPORTED_EXTENSIONS = list(extensions)
     settings.NOTIFICATION_POSITION = self._notify_position.currentIndex()
     qsettings.setValue('preferences/general/notification_position',
                        settings.NOTIFICATION_POSITION)
     settings.NOTIFICATION_COLOR = self._notification_choosed_color
     qsettings.setValue('preferences/general/notification_color',
                        settings.NOTIFICATION_COLOR)
    def save(self):
        """Save all Execution Preferences"""

        qsettings = IDE.ninja_settings()
        qsettings.beginGroup("execution")

        # Python executable
        settings.PYTHON_EXEC = self._combo_python_path.currentText()
        qsettings.setValue("pythonExec", settings.PYTHON_EXEC)

        # Execution options
        options = ""
        if self._check_B.isChecked():
            options += " -B"
        if self._check_d.isChecked():
            options += " -d"
        if self._check_E.isChecked():
            options += " -E"
        if self._check_O.isChecked():
            options += " -O"
        if self._check_OO.isChecked():
            options += " -OO"
        if self._check_s.isChecked():
            options += " -s"
        if self._check_S.isChecked():
            options += " -S"
        if self._check_v.isChecked():
            options += " -v"
        if self._check_W.isChecked():
            options += " -W" + self._combo_warning.currentText()
        settings.EXECUTION_OPTIONS = options
        qsettings.setValue("executionOptions", options)

        qsettings.endGroup()
Example #22
0
 def save_configuration(self):
     qsettings = IDE.ninja_settings()
     #Save the size of de splitters
     qsettings.setValue("window/central/baseSplitterSize",
         self._splitterBase.saveState())
     qsettings.setValue("window/central/insideSplitterSize",
         self._splitterInside.saveState())
     qsettings.setValue("window/central/lateralVisible",
         self.lateralPanel.isVisible())
Example #23
0
 def _reset_preferences(self):
     result = QMessageBox.question(self,
         translations.TR_PREFERENCES_GENERAL_RESET_TITLE,
         translations.TR_PREFERENCES_GENERAL_RESET_BODY,
         buttons=QMessageBox.Yes | QMessageBox.No)
     if result == QMessageBox.Yes:
         qsettings = IDE.ninja_settings()
         qsettings.clear()
         self._preferences.close()
Example #24
0
    def _save(self):
        qsettings = IDE.ninja_settings()
        settings.FONT = self._font
        qsettings.setValue('preferences/editor/font', settings.FONT)

        main_container = IDE.get_service("main_container")
        editor = main_container.get_current_editor()
        if editor is not None:
            editor.set_font(self._font)
 def _get_editor_skins(self):
     qsettings = IDE.ninja_settings()
     qsettings.beginGroup('preferences')
     qsettings.beginGroup('editor')
     self._schemes = json_manager.load_editor_skins()
     self._selected_scheme = qsettings.value('scheme', defaultValue='',
         type='QString')
     qsettings.endGroup()
     qsettings.endGroup()
Example #26
0
    def save(self):
        """Method to save settings"""
        qsettings = IDE.ninja_settings()
        settings.USE_TABS = bool(self._checkUseTabs.currentIndex())
        qsettings.setValue('preferences/editor/useTabs', settings.USE_TABS)
        margin_line = self._spinMargin.value()
        settings.MARGIN_LINE = margin_line
        settings.pep8mod_update_margin_line_length(margin_line)
        qsettings.setValue('preferences/editor/marginLine', margin_line)
        settings.SHOW_MARGIN_LINE = self._checkShowMargin.isChecked()
        qsettings.setValue('preferences/editor/showMarginLine',
                           settings.SHOW_MARGIN_LINE)
        settings.INDENT = self._spin.value()
        qsettings.setValue('preferences/editor/indent', settings.INDENT)
        endOfLine = self._checkEndOfLine.isChecked()
        settings.USE_PLATFORM_END_OF_LINE = endOfLine
        qsettings.setValue('preferences/editor/platformEndOfLine', endOfLine)
        settings.UNDERLINE_NOT_BACKGROUND = \
            bool(self._checkHighlightLine.currentIndex())
        qsettings.setValue('preferences/editor/errorsUnderlineBackground',
                           settings.UNDERLINE_NOT_BACKGROUND)
        settings.FIND_ERRORS = self._checkErrors.isChecked()
        qsettings.setValue('preferences/editor/errors', settings.FIND_ERRORS)
        settings.ERRORS_HIGHLIGHT_LINE = self._showErrorsOnLine.isChecked()
        qsettings.setValue('preferences/editor/errorsInLine',
                           settings.ERRORS_HIGHLIGHT_LINE)
        settings.CHECK_STYLE = self._checkStyle.isChecked()
        qsettings.setValue('preferences/editor/checkStyle',
                           settings.CHECK_STYLE)
        settings.SHOW_MIGRATION_TIPS = self._showMigrationTips.isChecked()
        qsettings.setValue('preferences/editor/showMigrationTips',
                           settings.SHOW_MIGRATION_TIPS)
        settings.CHECK_HIGHLIGHT_LINE = self._checkStyleOnLine.isChecked()
        qsettings.setValue('preferences/editor/checkStyleInline',
                           settings.CHECK_HIGHLIGHT_LINE)
        settings.CENTER_ON_SCROLL = self._checkCenterScroll.isChecked()
        qsettings.setValue('preferences/editor/centerOnScroll',
                           settings.CENTER_ON_SCROLL)
        settings.REMOVE_TRAILING_SPACES = self._checkTrailing.isChecked()
        qsettings.setValue('preferences/editor/removeTrailingSpaces',
                           settings.REMOVE_TRAILING_SPACES)
        settings.ALLOW_WORD_WRAP = self._allowWordWrap.isChecked()
        qsettings.setValue('preferences/editor/allowWordWrap',
                           settings.ALLOW_WORD_WRAP)
        settings.SHOW_TABS_AND_SPACES = self._checkShowSpaces.isChecked()
        qsettings.setValue('preferences/editor/showTabsAndSpaces',
                           settings.SHOW_TABS_AND_SPACES)
        settings.CHECK_FOR_DOCSTRINGS = self._checkForDocstrings.isChecked()
        qsettings.setValue('preferences/editor/checkForDocstrings',
                           settings.CHECK_FOR_DOCSTRINGS)

        if settings.USE_TABS:
            settings.pep8mod_add_ignore("W191")
        else:
            settings.pep8mod_remove_ignore("W191")
        settings.pep8mod_refresh_checks()
Example #27
0
    def toggle_tabs_and_spaces(self):
        """Toggle Show/Hide Tabs and Spaces"""

        settings.SHOW_TABS_AND_SPACES = not settings.SHOW_TABS_AND_SPACES
        qsettings = IDE.ninja_settings()
        qsettings.setValue('preferences/editor/show_tabs_and_spaces',
                           settings.SHOW_TABS_AND_SPACES)
        neditor = self.get_current_editor()
        if neditor is not None:
            neditor.show_whitespaces = settings.SHOW_TABS_AND_SPACES
Example #28
0
 def _reset_preferences(self):
     result = QMessageBox.question(
         self,
         translations.TR_PREFERENCES_GENERAL_RESET_TITLE,
         translations.TR_PREFERENCES_GENERAL_RESET_BODY,
         buttons=QMessageBox.Yes | QMessageBox.No)
     if result == QMessageBox.Yes:
         qsettings = IDE.ninja_settings()
         qsettings.clear()
         self._preferences.close()
 def _get_editor_skins(self):
     qsettings = IDE.ninja_settings()
     qsettings.beginGroup('preferences')
     qsettings.beginGroup('editor')
     self._schemes = json_manager.load_editor_skins()
     self._selected_scheme = qsettings.value('scheme',
                                             defaultValue='',
                                             type='QString')
     qsettings.endGroup()
     qsettings.endGroup()
Example #30
0
    def save_configuration(self):
        """Save the size of the splitters"""

        qsettings = IDE.ninja_settings()
        qsettings.setValue("window/central/base_splitter_size",
                           self._splitter_base.saveState())
        qsettings.setValue("window/central/inside_splitter_size",
                           self._splitter_inside.saveState())
        qsettings.setValue("window/central/lateral_visible",
                           self.lateral_panel.isVisible())
Example #31
0
    def save_configuration(self):
        """Save the size of the splitters"""

        qsettings = IDE.ninja_settings()
        qsettings.setValue("window/central/base_splitter_size",
                           self._splitter_base.saveState())
        qsettings.setValue("window/central/inside_splitter_size",
                           self._splitter_inside.saveState())
        qsettings.setValue("window/central/lateral_visible",
                           self.lateral_panel.isVisible())
Example #32
0
    def toggle_tabs_and_spaces(self):
        """Toggle Show/Hide Tabs and Spaces"""

        settings.SHOW_TABS_AND_SPACES = not settings.SHOW_TABS_AND_SPACES
        qsettings = IDE.ninja_settings()
        qsettings.setValue('preferences/editor/showTabsAndSpaces',
                           settings.SHOW_TABS_AND_SPACES)
        neditor = self.get_current_editor()
        if neditor is not None:
            neditor.show_whitespaces = settings.SHOW_TABS_AND_SPACES
Example #33
0
 def install(self):
     self.setup_ui()
     ide = IDE.get_service('ide')
     ide.place_me_on('tools_dock', self, 'central')
     ui_tools.install_shortcuts(self, actions.ACTIONS, ide)
     ide.goingDown.connect(self._save_settings)
     settings = IDE.ninja_settings()
     index = int(settings.value("tools_dock/tool_visible", -1))
     if index == -1:
         self.hide()
     else:
         self.set_current_index(index)
Example #34
0
    def save(self):
        """Save all Execution Preferences"""

        qsettings = IDE.ninja_settings()
        qsettings.beginGroup("preferences")
        qsettings.beginGroup("execution")
        qsettings.setValue("python_path",
                           self._combo_python_path.currentText())
        settings.PYTHON_EXEC = self._combo_python_path.currentText()

        qsettings.endGroup()
        qsettings.endGroup()
Example #35
0
 def install(self):
     self._load_ui()
     ninjaide = IDE.get_service("ide")
     ninjaide.place_me_on("tools_dock", self, "central")
     ui_tools.install_shortcuts(self, actions.ACTIONS, ninjaide)
     ninjaide.goingDown.connect(self._save_settings)
     ninja_settings = IDE.ninja_settings()
     index = int(ninja_settings.value("tools_dock/widgetVisible", -1))
     if index == -1:
         self.hide()
     else:
         self._show(index)
Example #36
0
 def install(self):
     self._load_ui()
     ninjaide = IDE.get_service("ide")
     ninjaide.place_me_on("tools_dock", self, "central")
     ui_tools.install_shortcuts(self, actions.ACTIONS, ninjaide)
     ninjaide.goingDown.connect(self._save_settings)
     ninja_settings = IDE.ninja_settings()
     index = int(ninja_settings.value("tools_dock/widgetVisible", -1))
     if index == -1:
         self.hide()
     else:
         self._show(index)
 def save(self):
     """
     Save all shortcuts to settings
     """
     settings = IDE.ninja_settings()
     settings.beginGroup("shortcuts")
     for index in range(self.result_widget.topLevelItemCount()):
         item = self.result_widget.topLevelItem(index)
         shortcut_keys = item.text(1)
         shortcut_name = item.text(2)
         settings.setValue(shortcut_name, shortcut_keys)
     settings.endGroup()
Example #38
0
    def install(self):
        """Install triggered by the ide."""
        self.setup_ui()
        ninjaide = IDE.get_service('ide')
        ninjaide.place_me_on("tools_dock", self, "central")
        ui_tools.install_shortcuts(self, actions.ACTIONS, ninjaide)

        self.connect(ninjaide, SIGNAL("goingDown()"), self.save_configuration)

        qsettings = IDE.ninja_settings()
        value = qsettings.value("tools_dock/visible", True, type=bool)
        self.setVisible(value)
Example #39
0
 def save(self):
     """
     Save all shortcuts to settings
     """
     settings = IDE.ninja_settings()
     settings.beginGroup("shortcuts")
     for index in range(self.result_widget.topLevelItemCount()):
         item = self.result_widget.topLevelItem(index)
         shortcut_keys = item.text(1)
         shortcut_name = item.text(2)
         settings.setValue(shortcut_name, shortcut_keys)
     settings.endGroup()
 def save(self):
     qsettings = IDE.ninja_settings()
     qsettings.setValue('preferences/editor/indent', self._spin.value())
     settings.INDENT = self._spin.value()
     endOfLine = self._checkEndOfLine.isChecked()
     qsettings.setValue('preferences/editor/platformEndOfLine', endOfLine)
     settings.USE_PLATFORM_END_OF_LINE = endOfLine
     margin_line = self._spinMargin.value()
     qsettings.setValue('preferences/editor/marginLine', margin_line)
     settings.MARGIN_LINE = margin_line
     settings.pep8mod_update_margin_line_length(margin_line)
     qsettings.setValue('preferences/editor/showMarginLine',
         self._checkShowMargin.isChecked())
     settings.SHOW_MARGIN_LINE = self._checkShowMargin.isChecked()
     settings.UNDERLINE_NOT_BACKGROUND = \
         self._checkHighlightLine.isChecked()
     qsettings.setValue('preferences/editor/errorsUnderlineBackground',
         settings.UNDERLINE_NOT_BACKGROUND)
     qsettings.setValue('preferences/editor/errors',
         self._checkErrors.isChecked())
     settings.FIND_ERRORS = self._checkErrors.isChecked()
     qsettings.setValue('preferences/editor/errorsInLine',
         self._showErrorsOnLine.isChecked())
     settings.ERRORS_HIGHLIGHT_LINE = self._showErrorsOnLine.isChecked()
     qsettings.setValue('preferences/editor/checkStyle',
         self._checkStyle.isChecked())
     settings.CHECK_STYLE = self._checkStyle.isChecked()
     qsettings.setValue('preferences/editor/showMigrationTips',
         self._showMigrationTips.isChecked())
     settings.SHOW_MIGRATION_TIPS = self._showMigrationTips.isChecked()
     qsettings.setValue('preferences/editor/checkStyleInline',
         self._checkStyleOnLine.isChecked())
     settings.CHECK_HIGHLIGHT_LINE = self._checkStyleOnLine.isChecked()
     qsettings.setValue('preferences/editor/centerOnScroll',
         self._checkCenterScroll.isChecked())
     settings.CENTER_ON_SCROLL = self._checkCenterScroll.isChecked()
     qsettings.setValue('preferences/editor/removeTrailingSpaces',
         self._checkTrailing.isChecked())
     settings.REMOVE_TRAILING_SPACES = self._checkTrailing.isChecked()
     qsettings.setValue('preferences/editor/showTabsAndSpaces',
         self._checkShowSpaces.isChecked())
     settings.SHOW_TABS_AND_SPACES = self._checkShowSpaces.isChecked()
     qsettings.setValue('preferences/editor/useTabs',
         self._checkUseTabs.isChecked())
     settings.USE_TABS = self._checkUseTabs.isChecked()
     qsettings.setValue('preferences/editor/allowWordWrap',
         self._allowWordWrap.isChecked())
     settings.ALLOW_WORD_WRAP = self._allowWordWrap.isChecked()
     qsettings.setValue('preferences/editor/checkForDocstrings',
         self._checkForDocstrings.isChecked())
     settings.CHECK_FOR_DOCSTRINGS = self._checkForDocstrings.isChecked()
Example #41
0
    def save(self):
        """Save all preferences values"""

        qsettings = IDE.ninja_settings()
        qsettings.beginGroup("ide")

        qsettings.setValue("loadFiles", self._check_last_session.isChecked())
        qsettings.setValue("notifyUpdates",
                           self._check_notify_updates.isChecked())
        settings.WORKSPACE = self._text_workspace.text()
        qsettings.setValue("workspace", settings.WORKSPACE)
        settings.RELOAD_FILE = self._combo_mod.currentIndex()
        qsettings.setValue("reloadSetting", settings.RELOAD_FILE)

        qsettings.endGroup()
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.FONT = self._font
     qsettings.setValue("preferences/editor/font", settings.FONT)
     settings.SHOW_MINIMAP = self._checkShowMinimap.isChecked()
     settings.MINIMAP_MAX_OPACITY = self._spinMaxOpacity.value() / 100.0
     settings.MINIMAP_MIN_OPACITY = self._spinMinOpacity.value() / 100.0
     settings.SIZE_PROPORTION = self._spinSize.value() / 100.0
     qsettings.setValue("preferences/editor/minimapMaxOpacity", settings.MINIMAP_MAX_OPACITY)
     qsettings.setValue("preferences/editor/minimapMinOpacity", settings.MINIMAP_MIN_OPACITY)
     qsettings.setValue("preferences/editor/minimapSizeProportion", settings.SIZE_PROPORTION)
     qsettings.setValue("preferences/editor/minimapShow", settings.SHOW_MINIMAP)
     scheme = self._listScheme.currentItem().text()
     resources.CUSTOM_SCHEME = self._schemes.get(scheme, resources.COLOR_SCHEME)
     qsettings.setValue("preferences/editor/scheme", scheme)
Example #43
0
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.FONT = self._font
     qsettings.setValue('preferences/editor/font', settings.FONT)
     settings.SHOW_MINIMAP = self._checkShowMinimap.isChecked()
     settings.MINIMAP_MAX_OPACITY = self._spinMaxOpacity.value() / 100.0
     settings.MINIMAP_MIN_OPACITY = self._spinMinOpacity.value() / 100.0
     settings.SIZE_PROPORTION = self._spinSize.value() / 100.0
     qsettings.setValue('preferences/editor/minimapMaxOpacity',
                        settings.MINIMAP_MAX_OPACITY)
     qsettings.setValue('preferences/editor/minimapMinOpacity',
                        settings.MINIMAP_MIN_OPACITY)
     qsettings.setValue('preferences/editor/minimapSizeProportion',
                        settings.SIZE_PROPORTION)
     qsettings.setValue('preferences/editor/minimapShow',
                        settings.SHOW_MINIMAP)
     scheme = self._listScheme.currentItem().text()
     resources.CUSTOM_SCHEME = self._schemes.get(scheme,
                                                 resources.COLOR_SCHEME)
     qsettings.setValue('preferences/editor/scheme', scheme)
 def save(self):
     """Save all the Execution Preferences"""
     qsettings = IDE.ninja_settings()
     qsettings.beginGroup('preferences')
     qsettings.beginGroup('execution')
     qsettings.setValue('pythonPath', self._txtPythonPath.text())
     settings.PYTHON_PATH = self._txtPythonPath.text()
     options = ''
     if self.check_B.isChecked():
         options += ' -B'
     if self.check_d.isChecked():
         options += ' -d'
     if self.check_E.isChecked():
         options += ' -E'
     if self.check_O.isChecked():
         options += ' -O'
     if self.check_OO.isChecked():
         options += ' -OO'
     if self.check_Q.isChecked():
         options += ' -Q' + self.comboDivision.currentText()
     if self.check_s.isChecked():
         options += ' -s'
     if self.check_S.isChecked():
         options += ' -S'
     if self.check_t.isChecked():
         options += ' -t'
     if self.check_tt.isChecked():
         options += ' -tt'
     if self.check_v.isChecked():
         options += ' -v'
     if self.check_W.isChecked():
         options += ' -W' + self.comboWarning.currentText()
     if self.check_x.isChecked():
         options += ' -x'
     if self.check_3.isChecked():
         options += ' -3'
     settings.EXECUTION_OPTIONS = options
     qsettings.setValue('executionOptions', options)
     qsettings.endGroup()
     qsettings.endGroup()
Example #45
0
 def save(self):
     """Save all the Execution Preferences"""
     qsettings = IDE.ninja_settings()
     qsettings.beginGroup('preferences')
     qsettings.beginGroup('execution')
     qsettings.setValue('pythonPath', self._txtPythonPath.text())
     settings.PYTHON_PATH = self._txtPythonPath.text()
     options = ''
     if self.check_B.isChecked():
         options += ' -B'
     if self.check_d.isChecked():
         options += ' -d'
     if self.check_E.isChecked():
         options += ' -E'
     if self.check_O.isChecked():
         options += ' -O'
     if self.check_OO.isChecked():
         options += ' -OO'
     if self.check_Q.isChecked():
         options += ' -Q' + self.comboDivision.currentText()
     if self.check_s.isChecked():
         options += ' -s'
     if self.check_S.isChecked():
         options += ' -S'
     if self.check_t.isChecked():
         options += ' -t'
     if self.check_tt.isChecked():
         options += ' -tt'
     if self.check_v.isChecked():
         options += ' -v'
     if self.check_W.isChecked():
         options += ' -W' + self.comboWarning.currentText()
     if self.check_x.isChecked():
         options += ' -x'
     if self.check_3.isChecked():
         options += ' -3'
     settings.EXECUTION_OPTIONS = options
     qsettings.setValue('executionOptions', options)
     qsettings.endGroup()
     qsettings.endGroup()
Example #46
0
 def save(self):
     qsettings = IDE.ninja_settings()
     qsettings.setValue('preferences/general/loadFiles',
                        self._checkLastSession.isChecked())
     qsettings.setValue('preferences/general/activatePlugins',
                        self._checkActivatePlugins.isChecked())
     qsettings.setValue('preferences/general/notifyUpdates',
                        self._checkNotifyUpdates.isChecked())
     qsettings.setValue('preferences/general/showStartPage',
                        self._checkShowStartPage.isChecked())
     settings.NOTIFY_UPDATES = self._checkNotifyUpdates.isChecked()
     qsettings.setValue('preferences/general/confirmExit',
                        self._checkConfirmExit.isChecked())
     settings.CONFIRM_EXIT = self._checkConfirmExit.isChecked()
     qsettings.setValue('preferences/general/workspace',
                        self._txtWorkspace.text())
     settings.WORKSPACE = self._txtWorkspace.text()
     extensions = str(self._txtExtensions.text()).split(',')
     extensions = [e.strip() for e in extensions]
     qsettings.setValue('preferences/general/supportedExtensions',
                        extensions)
     settings.SUPPORTED_EXTENSIONS = list(extensions)
Example #47
0
    def save(self):
        """Save all preferences values"""

        qsettings = IDE.ninja_settings()
        qsettings.beginGroup("ide")

        settings.CONFIRM_EXIT = self._check_confirm_exit.isChecked()
        qsettings.setValue("confirmExit", settings.CONFIRM_EXIT)
        qsettings.setValue("loadFiles", self._check_last_session.isChecked())
        qsettings.setValue("notifyUpdates",
                           self._check_notify_updates.isChecked())
        settings.WORKSPACE = self._text_workspace.text()
        qsettings.setValue("workspace", settings.WORKSPACE)
        settings.RELOAD_FILE = self._combo_mod.currentIndex()
        qsettings.setValue("reloadSetting", settings.RELOAD_FILE)

        settings.SWAP_FILE = self._combo_swap_file.currentIndex()
        qsettings.setValue("swapFile", settings.SWAP_FILE)
        settings.SWAP_FILE_INTERVAL = self._spin_swap.value()
        qsettings.setValue("swapFileInterval", settings.SWAP_FILE_INTERVAL)

        qsettings.endGroup()
Example #48
0
 def showEvent(self, event):
     super(CentralWidget, self).showEvent(event)
     # Rearrange widgets on Window
     qsettings = IDE.ninja_settings()
     # Lists of sizes as list of QVariant- heightList = [QVariant, QVariant]
     height_size = qsettings.value("window/central/inside_splitter_size",
                                   None)
     width_size = qsettings.value("window/central/base_splitter_size", None)
     lateral_visible = qsettings.value("window/central/lateral_visible",
                                       True,
                                       type=bool)
     if height_size is None:
         self._splitter_inside.setSizes([(self.height() / 3) * 2,
                                         self.height() / 3])
     else:
         self._splitter_inside.restoreState(height_size)
     if width_size is None:
         self._splitter_base.setSizes([900, 300])
     else:
         self._splitter_base.restoreState(width_size)
     if not lateral_visible:
         self.lateral_panel.hide()
Example #49
0
 def save(self):
     qsettings = IDE.ninja_settings()
     qsettings.setValue('preferences/general/loadFiles',
         self._checkLastSession.isChecked())
     qsettings.setValue('preferences/general/activatePlugins',
         self._checkActivatePlugins.isChecked())
     qsettings.setValue('preferences/general/notifyUpdates',
         self._checkNotifyUpdates.isChecked())
     qsettings.setValue('preferences/general/showStartPage',
         self._checkShowStartPage.isChecked())
     settings.NOTIFY_UPDATES = self._checkNotifyUpdates.isChecked()
     qsettings.setValue('preferences/general/confirmExit',
         self._checkConfirmExit.isChecked())
     settings.CONFIRM_EXIT = self._checkConfirmExit.isChecked()
     qsettings.setValue('preferences/general/workspace',
         self._txtWorkspace.text())
     settings.WORKSPACE = self._txtWorkspace.text()
     extensions = str(self._txtExtensions.text()).split(',')
     extensions = [e.strip() for e in extensions]
     qsettings.setValue('preferences/general/supportedExtensions',
         extensions)
     settings.SUPPORTED_EXTENSIONS = list(extensions)
 def save(self):
     qsettings = IDE.ninja_settings()
     if self._checkParentheses.isChecked():
         settings.BRACES['('] = ')'
     elif ('(') in settings.BRACES:
         del settings.BRACES['(']
     qsettings.setValue('preferences/editor/parentheses',
         self._checkParentheses.isChecked())
     if self._checkBrackets.isChecked():
         settings.BRACES['['] = ']'
     elif ('[') in settings.BRACES:
         del settings.BRACES['[']
     qsettings.setValue('preferences/editor/brackets',
         self._checkBrackets.isChecked())
     if self._checkKeys.isChecked():
         settings.BRACES['{'] = '}'
     elif ('{') in settings.BRACES:
         del settings.BRACES['{']
     qsettings.setValue('preferences/editor/keys',
         self._checkKeys.isChecked())
     if self._checkSimpleQuotes.isChecked():
         settings.QUOTES["'"] = "'"
     elif ("'") in settings.QUOTES:
         del settings.QUOTES["'"]
     qsettings.setValue('preferences/editor/simpleQuotes',
         self._checkSimpleQuotes.isChecked())
     if self._checkDoubleQuotes.isChecked():
         settings.QUOTES['"'] = '"'
     elif ('"') in settings.QUOTES:
         del settings.QUOTES['"']
     qsettings.setValue('preferences/editor/doubleQuotes',
         self._checkDoubleQuotes.isChecked())
     settings.CODE_COMPLETION = self._checkCodeDot.isChecked()
     qsettings.setValue('preferences/editor/codeCompletion',
         self._checkCodeDot .isChecked())
     settings.COMPLETE_DECLARATIONS = \
         self._checkCompleteDeclarations.isChecked()
     qsettings.setValue("preferences/editor/completeDeclarations",
         settings.COMPLETE_DECLARATIONS)
Example #51
0
 def save(self):
     qsettings = IDE.ninja_settings()
     settings.FONT = self._font
     qsettings.setValue('preferences/editor/font', settings.FONT)
     settings.SHOW_MINIMAP = self._checkShowMinimap.isChecked()
     settings.MINIMAP_MAX_OPACITY = self._spinMaxOpacity.value() / 100.0
     settings.MINIMAP_MIN_OPACITY = self._spinMinOpacity.value() / 100.0
     settings.SIZE_PROPORTION = self._spinSize.value() / 100.0
     qsettings.setValue('preferences/editor/minimapMaxOpacity',
                        settings.MINIMAP_MAX_OPACITY)
     qsettings.setValue('preferences/editor/minimapMinOpacity',
                        settings.MINIMAP_MIN_OPACITY)
     qsettings.setValue('preferences/editor/minimapSizeProportion',
                        settings.SIZE_PROPORTION)
     qsettings.setValue('preferences/editor/minimapShow',
                        settings.SHOW_MINIMAP)
     settings.SHOW_DOCMAP = self._checkShowDocMap.isChecked()
     settings.DOCMAP_SLIDER = self._checkShowSlider.isChecked()
     settings.EDITOR_SCROLLBAR = self._checkOriginalScroll.isChecked()
     settings.DOCMAP_CURRENT_LINE = self._checkCurrentLine.isChecked()
     settings.DOCMAP_SEARCH_LINES = self._checkSearchLines.isChecked()
     settings.DOCMAP_WIDTH = self._spinWidth.value()
     qsettings.setValue('preferences/editor/docmapShow',
                        settings.SHOW_DOCMAP)
     qsettings.setValue('preferences/editor/docmapSlider',
                        settings.DOCMAP_SLIDER)
     qsettings.setValue('preferences/editor/editorScrollBar',
                        settings.EDITOR_SCROLLBAR)
     qsettings.setValue('preferences/editor/docmapCurrentLine',
                        settings.DOCMAP_CURRENT_LINE)
     qsettings.setValue('preferences/editor/docmapSearchLines',
                        settings.DOCMAP_SEARCH_LINES)
     qsettings.setValue('preferences/editor/docmapWidth',
                        settings.DOCMAP_WIDTH)
     scheme = self._listScheme.currentItem().text()
     resources.CUSTOM_SCHEME = self._schemes.get(scheme,
                                                 resources.COLOR_SCHEME)
     qsettings.setValue('preferences/editor/scheme', scheme)
Example #52
0
    def __init__(self, parent):
        super(GeneralConfiguration, self).__init__()
        self._preferences = parent
        vbox = QVBoxLayout(self)

        groupBoxStart = QGroupBox(translations.TR_PREFERENCES_GENERAL_START)
        groupBoxClose = QGroupBox(translations.TR_PREFERENCES_GENERAL_CLOSE)
        groupBoxWorkspace = QGroupBox(
            translations.TR_PREFERENCES_GENERAL_WORKSPACE)
        groupBoxNoti = QGroupBox(translations.TR_NOTIFICATION)
        groupBoxReset = QGroupBox(translations.TR_PREFERENCES_GENERAL_RESET)

        #Start
        vboxStart = QVBoxLayout(groupBoxStart)
        self._checkLastSession = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_LOAD_LAST_SESSION)
        self._checkActivatePlugins = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_ACTIVATE_PLUGINS)
        self._checkNotifyUpdates = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_NOTIFY_UPDATES)
        self._checkShowStartPage = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_SHOW_START_PAGE)
        vboxStart.addWidget(self._checkLastSession)
        vboxStart.addWidget(self._checkActivatePlugins)
        vboxStart.addWidget(self._checkNotifyUpdates)
        vboxStart.addWidget(self._checkShowStartPage)
        #Close
        vboxClose = QVBoxLayout(groupBoxClose)
        self._checkConfirmExit = QCheckBox(
            translations.TR_PREFERENCES_GENERAL_CONFIRM_EXIT)
        vboxClose.addWidget(self._checkConfirmExit)
        #Workspace and Project
        gridWorkspace = QGridLayout(groupBoxWorkspace)
        self._txtWorkspace = QLineEdit()
        ui_tools.LineEditButton(
            self._txtWorkspace,
            self._txtWorkspace.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self._txtWorkspace.setReadOnly(True)
        self._btnWorkspace = QPushButton(QIcon(':img/openFolder'), '')
        gridWorkspace.addWidget(
            QLabel(translations.TR_PREFERENCES_GENERAL_WORKSPACE), 0, 0,
            Qt.AlignRight)
        gridWorkspace.addWidget(self._txtWorkspace, 0, 1)
        gridWorkspace.addWidget(self._btnWorkspace, 0, 2)
        self._txtExtensions = QLineEdit()
        self._txtExtensions.setToolTip(
            translations.TR_PROJECT_EXTENSIONS_TOOLTIP)
        gridWorkspace.addWidget(QLabel(
            translations.TR_PREFERENCES_GENERAL_SUPPORTED_EXT), 1, 0,
            Qt.AlignRight)
        gridWorkspace.addWidget(self._txtExtensions, 1, 1)
        labelTooltip = QLabel(translations.TR_PROJECT_EXTENSIONS_INSTRUCTIONS)
        gridWorkspace.addWidget(labelTooltip, 2, 1)

        # Notification
        hboxNoti, self._notify_position = QHBoxLayout(groupBoxNoti), QComboBox()
        self._notify_position.addItems(
            [translations.TR_BOTTOM + "-" + translations.TR_LEFT,
             translations.TR_BOTTOM + "-" + translations.TR_RIGHT,
             translations.TR_TOP + "-" + translations.TR_LEFT,
             translations.TR_TOP + "-" + translations.TR_RIGHT])
        self._notify_color = QPushButton(
            translations.TR_EDITOR_SCHEME_PICK_COLOR)
        self._notification_choosed_color = settings.NOTIFICATION_COLOR
        hboxNoti.addWidget(QLabel(translations.TR_POSITION_ON_SCREEN))
        hboxNoti.addWidget(self._notify_position)
        hboxNoti.addWidget(self._notify_color, 0, Qt.AlignRight)

        # Resetting preferences
        vboxReset = QVBoxLayout(groupBoxReset)
        self._btnReset = QPushButton(
            translations.TR_PREFERENCES_GENERAL_RESET_PREFERENCES)
        vboxReset.addWidget(self._btnReset, alignment=Qt.AlignLeft)

        #Settings
        qsettings = IDE.ninja_settings()
        qsettings.beginGroup('preferences')
        qsettings.beginGroup('general')
        self._checkLastSession.setChecked(
            qsettings.value('loadFiles', True, type=bool))
        self._checkActivatePlugins.setChecked(
            qsettings.value('activatePlugins', defaultValue=True, type=bool))
        self._checkNotifyUpdates.setChecked(
            qsettings.value('preferences/general/notifyUpdates',
                            defaultValue=True, type=bool))
        self._checkShowStartPage.setChecked(settings.SHOW_START_PAGE)
        self._checkConfirmExit.setChecked(settings.CONFIRM_EXIT)
        self._txtWorkspace.setText(settings.WORKSPACE)
        extensions = ', '.join(settings.SUPPORTED_EXTENSIONS)
        self._txtExtensions.setText(extensions)
        self._notify_position.setCurrentIndex(settings.NOTIFICATION_POSITION)
        qsettings.endGroup()
        qsettings.endGroup()

        vbox.addWidget(groupBoxStart)
        vbox.addWidget(groupBoxClose)
        vbox.addWidget(groupBoxWorkspace)
        vbox.addWidget(groupBoxNoti)
        vbox.addWidget(groupBoxReset)

        #Signals
        self.connect(self._btnWorkspace, SIGNAL("clicked()"),
                     self._load_workspace)
        self.connect(self._notify_color, SIGNAL("clicked()"), self._pick_color)
        self.connect(self._btnReset, SIGNAL('clicked()'),
                     self._reset_preferences)
        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
    def __init__(self, parent):
        super(EditorGeneral, self).__init__()
        self._preferences, vbox = parent, QVBoxLayout(self)
        self.original_style = copy.copy(resources.CUSTOM_SCHEME)
        self.current_scheme, self._modified_editors = 'default', []
        self._font = settings.FONT

        groupBoxMini = QGroupBox(
            translations.TR_PREFERENCES_EDITOR_GENERAL_MINIMAP)
        groupBoxTypo = QGroupBox(
            translations.TR_PREFERENCES_EDITOR_GENERAL_TYPOGRAPHY)
        groupBoxScheme = QGroupBox(
            translations.TR_PREFERENCES_EDITOR_GENERAL_SCHEME)

        #Minimap
        formMini = QGridLayout(groupBoxMini)
        formMini.setContentsMargins(5, 15, 5, 5)
        self._checkShowMinimap = QCheckBox(
            translations.TR_PREFERENCES_EDITOR_GENERAL_ENABLE_MINIMAP)
        self._spinMaxOpacity = QSpinBox()
        self._spinMaxOpacity.setRange(0, 100)
        self._spinMaxOpacity.setSuffix("% Max.")
        self._spinMinOpacity = QSpinBox()
        self._spinMinOpacity.setRange(0, 100)
        self._spinMinOpacity.setSuffix("% Min.")
        self._spinSize = QSpinBox()
        self._spinSize.setMaximum(100)
        self._spinSize.setMinimum(0)
        self._spinSize.setSuffix(
            translations.TR_PREFERENCES_EDITOR_GENERAL_AREA_MINIMAP)
        formMini.addWidget(self._checkShowMinimap, 0, 1)
        formMini.addWidget(QLabel(
            translations.TR_PREFERENCES_EDITOR_GENERAL_SIZE_MINIMAP), 1, 0,
            Qt.AlignRight)
        formMini.addWidget(self._spinSize, 1, 1)
        formMini.addWidget(QLabel(
            translations.TR_PREFERENCES_EDITOR_GENERAL_OPACITY), 2, 0,
            Qt.AlignRight)
        formMini.addWidget(self._spinMinOpacity, 2, 1)
        formMini.addWidget(self._spinMaxOpacity, 2, 2)
        #Typo
        gridTypo = QGridLayout(groupBoxTypo)
        gridTypo.setContentsMargins(5, 15, 5, 5)
        self._btnEditorFont = QPushButton('')
        gridTypo.addWidget(QLabel(
            translations.TR_PREFERENCES_EDITOR_GENERAL_EDITOR_FONT), 0, 0,
            Qt.AlignRight)
        gridTypo.addWidget(self._btnEditorFont, 0, 1)
        #Scheme
        vboxScheme = QVBoxLayout(groupBoxScheme)
        vboxScheme.setContentsMargins(5, 15, 5, 5)
        self._listScheme = QListWidget()
        vboxScheme.addWidget(self._listScheme)
        hbox = QHBoxLayout()
        btnDownload = QPushButton(
            translations.TR_PREFERENCES_EDITOR_DOWNLOAD_SCHEME)
        btnDownload.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.connect(btnDownload, SIGNAL("clicked()"),
                     self._open_schemes_manager)
        hbox.addWidget(btnDownload)
        btnAdd = QPushButton(QIcon(":img/add"),
                             translations.TR_EDITOR_CREATE_SCHEME)
        btnAdd.setIconSize(QSize(16, 16))
        btnAdd.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.connect(btnAdd, SIGNAL("clicked()"), self._open_schemes_designer)
        btnRemove = QPushButton(QIcon(":img/delete"),
                                translations.TR_EDITOR_REMOVE_SCHEME)
        btnRemove.setIconSize(QSize(16, 16))
        btnRemove.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.connect(btnRemove, SIGNAL("clicked()"), self._remove_scheme)
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(btnAdd)
        hbox.addWidget(btnRemove)
        vboxScheme.addLayout(hbox)

        vbox.addWidget(groupBoxMini)
        vbox.addWidget(groupBoxTypo)
        vbox.addWidget(groupBoxScheme)

        #Settings
        qsettings = IDE.ninja_settings()
        qsettings.beginGroup('preferences')
        qsettings.beginGroup('editor')
        self._checkShowMinimap.setChecked(settings.SHOW_MINIMAP)
        if settings.IS_MAC_OS:
            self._spinMinOpacity.setValue(100)
            self._spinMaxOpacity.setValue(100)
            self._spinMinOpacity.setDisabled(True)
            self._spinMaxOpacity.setDisabled(True)
        else:
            self._spinMinOpacity.setValue(settings.MINIMAP_MIN_OPACITY * 100)
            self._spinMaxOpacity.setValue(settings.MINIMAP_MAX_OPACITY * 100)
        self._spinSize.setValue(settings.SIZE_PROPORTION * 100)
        btnText = ', '.join(self._font.toString().split(',')[0:2])
        self._btnEditorFont.setText(btnText)
        self._listScheme.clear()
        self._listScheme.addItem('default')
        self._schemes = json_manager.load_editor_skins()
        for item in self._schemes:
            self._listScheme.addItem(item)
        items = self._listScheme.findItems(
            qsettings.value('scheme', defaultValue='',
                            type='QString'), Qt.MatchExactly)
        if items:
            self._listScheme.setCurrentItem(items[0])
        else:
            self._listScheme.setCurrentRow(0)
        qsettings.endGroup()
        qsettings.endGroup()

        #Signals
        self.connect(self._btnEditorFont,
                     SIGNAL("clicked()"), self._load_editor_font)
        self.connect(self._listScheme, SIGNAL("itemSelectionChanged()"),
                     self._preview_style)
        self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
 def set_activated_plugins(self, activated):
     qsettings = IDE.ninja_settings()
     qsettings.setValue('plugins/registry/activated', activated)
Example #55
0
 def save_configuration(self):
     qsettings = IDE.ninja_settings()
     qsettings.setValue("tools_dock/visible", self.isVisible())
 def set_failstate_plugins(self, failure):
     qsettings = IDE.ninja_settings()
     qsettings.setValue('plugins/registry/failure', failure)