pyqode.core package

Subpackages

Submodules

pyqode.core.cache module

This module contains a class to access the pyQode settings (QSettings).

QSettings are used to cache some specific settings.

At the moment, we use it to store the lists of encoding that appears in the encoding menu (to not have a too big encoding menu, user can choose which encoding should be display, offering a small compact menu with all its favorite encodings). We also cache encoding used to save or load a file so that we can reuse it automatically next time the user want to open the same file.

We also use this to cache some editor states (such as the last cursor position for a specific file path)

We do not store editor styles and settings here. Those kind of settings are better handled at the application level.

class pyqode.core.cache.Cache(suffix='')[source]

Bases: builtins.object

Provides an easy acces to the cache by exposing some wrapper properties over QSettings.

clear()[source]

Clears the cache.

get_cursor_position(file_path)[source]

Gets the cached cursor position for file_path

Parameters:file_path – path of the file in the cache
Returns:Cached cursor position or (0, 0)
get_file_encoding(file_path)[source]

Gets an eventual cached encoding for file_path.

Raises a KeyError if no encoding were cached for the specified file path.

Parameters:file_path – path of the file to look up
Returns:The cached encoding.
set_cursor_position(path, position)[source]

Cache encoding for the specified file path.

Parameters:
  • path – path of the file to cache
  • position – cursor position to cache
set_file_encoding(path, encoding)[source]

Cache encoding for the specified file path.

Parameters:
  • path – path of the file to cache
  • encoding – encoding to cache
preferred_encodings[source]

The list of user defined encodings, for display in the encodings menu/combobox.

Module contents

The core package contains the core components needed for writing a pyqode based application. It is the “de facto” requirement for any pyqode extension.

It contains the base classes for both the backend and the frontend and provides a series of modes and panels that might be useful for any kind of code editor widget, i.e. pyqode.core is a generic code editor widget.

Table Of Contents

Previous topic

Welcome to pyqode.core’s API reference documentation!

Next topic

pyqode.core.api package