turtlico.lib.icon package

Submodules

turtlico.lib.icon.base module

class turtlico.lib.icon.base.CommandColor(value)

Bases: enum.Enum

An enumeration.

BORDER = 11
COMMENT = 2
CYCLE = 3
DEFAULT = 0
INDENTATION = 1
KEYWORD = 4
NUMBER = 5
OBJECT = 7
OVERLAY_COMMENT = 10
OVERLAY_SELECTION = 9
STRING = 6
TYPE_CONV = 8
class turtlico.lib.icon.base.CommandIconInterface

Bases: object

Represents a command icon (only the image in the center without background). The two implementations are TextTexture and SVGFileTexture.

abstract snapshot(snapshot: gi.repository.Gtk.Snapshot, bounds: gi.repository.Graphene.Rect, fgcolor: gi.repository.Gdk.RGBA, scale: float)
class turtlico.lib.icon.base.SVGFileTexture(path: str)

Bases: turtlico.lib.icon.base.CommandIconInterface

Represents SVG icon. Can be obtained via icon function.

snapshot(snapshot: gi.repository.Gtk.Snapshot, bounds: gi.repository.Graphene.Rect, fgcolor: gi.repository.Gdk.RGBA, scale: float)
class turtlico.lib.icon.base.TextTexture(text: str)

Bases: turtlico.lib.icon.base.CommandIconInterface

Represents text only icon. Can be obtained via text function.

snapshot(snapshot: gi.repository.Gtk.Snapshot, bounds: gi.repository.Graphene.Rect, fgcolor: gi.repository.Gdk.RGBA, scale: float)
turtlico.lib.icon.base.get_default_colors() Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]]
turtlico.lib.icon.base.get_default_colors_dark() Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]]
turtlico.lib.icon.base.icon(icon: str) turtlico.lib.icon.base.SVGFileTexture

Creates SVGFileTexture from file path.

Parameters
  • icon (str) – Path to the svg file.

  • subdirectory (It should be just the name of a file in the icons) –

  • directory. (of the plugin) –

Returns

The newly created icon texture

Return type

SVGFileTexture

turtlico.lib.icon.base.text(icon: str) turtlico.lib.icon.base.TextTexture

Creates TextTexture from a string.

Parameters

icon (str) – The string

Returns

The newly created text texture

Return type

TextTexture

turtlico.lib.icon.base.validate_color_scheme(scheme: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]])

turtlico.lib.icon.rendering module

class turtlico.lib.icon.rendering.SingleIconWidget(colors: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]])

Bases: gi.overrides.Gtk.Widget

do_get_request_mode()

get_request_mode(self) -> Gtk.SizeRequestMode

do_measure(orientation, for_size)

measure(self, orientation:Gtk.Orientation, for_size:int) -> minimum:int, natural:int, minimum_baseline:int, natural_baseline:int

do_query_tooltip(x, y, keyboard_tooltip: bool, tooltip: gi.repository.Gtk.Tooltip) bool

query_tooltip(self, x:int, y:int, keyboard_tooltip:bool, tooltip:Gtk.Tooltip) -> bool

do_snapshot(snapshot)

snapshot(self, snapshot:Gtk.Snapshot)

set_command(command: turtlico.lib.command.Command)
turtlico.lib.icon.rendering.append_block_to_snapshot(commands: List[List[turtlico.lib.command.Command]], snapshot: gi.repository.Gtk.Snapshot, tx: int, ty: int, widget: gi.overrides.Gtk.Widget, colors: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]], code: Optional[turtlico.lib.codepiece.CodeBuffer] = None, end_x=None, start_y=0, end_y=None, debug_info: Optional[dict] = None) tuple
turtlico.lib.icon.rendering.append_to_snapshot(cmd: turtlico.lib.command.Command, snapshot: gi.repository.Gtk.Snapshot, x, y, widget: gi.overrides.Gtk.Widget, colors: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]], code: Optional[turtlico.lib.codepiece.CodeBuffer] = None) int
turtlico.lib.icon.rendering.calc_icon_width(cmd: turtlico.lib.command.Command, widget: gi.overrides.Gtk.Widget) int
turtlico.lib.icon.rendering.prepare_drag(source: gi.repository.Gtk.DragSource, commands: List[List[turtlico.lib.command.Command]], widget: gi.overrides.Gtk.Widget, colors: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]], code: Optional[turtlico.lib.codepiece.CodeBuffer] = None) gi.repository.Gdk.ContentProvider
turtlico.lib.icon.rendering.prepare_drag_paintable(commands: List[List[turtlico.lib.command.Command]], widget: gi.overrides.Gtk.Widget, colors: Dict[turtlico.lib.icon.base.CommandColor, Tuple[gi.repository.Gdk.RGBA, gi.repository.Gdk.RGBA]], code: Optional[turtlico.lib.codepiece.CodeBuffer] = None) tuple

Creates a paintable that is supposed to be used as a drag icon

Parameters
  • commands (lib.CodePiece) – Commands to display

  • widget (Gtk.Widget) – Widget that request the paintable

  • colors (lib.icon.CommandColorScheme) – Color scheme

Returns

Paintable, hot x, hot y

Return type

tuple[Gdk.Paintable, int, int]

Module contents