BrickStore Extensions Documentation

BrickStore can be extended via JavaScript/QML based extensions.

The QML BrickStore module provides the necessary types for scripting extension in the desktop version (as well as for creating complete mobile user interfaces).

Installation

Installing an extension from a file, so that it can be used by BrickStore is covered here:

BrickStore Extension Installation

Porting old Scripts

Print scripts from old BrickStore (or BrickStock) versions are not compatible anymore and need to be ported manually. You can find a porting guide here:

Porting old BrickStore and BrickStock Print Scripts

Writing Extensions

Your best bet is to start by cloning an existing extension to get all the needed boiler plate code.

Extensions are based on QML and JavaScript. These QML types can be imported into your application or extension using the following import statement in your .qml file:

import BrickStore
import BrickLink
import QtQuick

Your root object is always Script followed by one or more child elements of type PrintingScriptAction and ExtensionScriptAction. All the other types can not be instantiated in a declarative way, but are instead provided to your extensions interface functions as parameters, or they can be dynamically created/retrieved via the global singletons BrickStore and BrickLink.

These types are available to setup and manage an extension:

ExtensionScriptAction

Use this type to add an UI action to your extension

PrintingScriptAction

Use this type to add a print action to your extension

Script

Root element of any BrickStore extension file

While the extension is active, you have acess to these types:

BrickLink

Core singleton managing the data transfer from and to BrickLink

BrickStore

This singleton represents global settings and state

Category

This value type represents a BrickLink item category

Color

This value type represents a BrickLink color

Database

This type represents the BrickLink catalog database

Document

Each instance of this type represents an open document

Item

This value type represents a BrickLink item

ItemType

This value type represents a BrickLink item type

Lot

This value type represent a lot in a document

OnlineState

This singleton represents the network state

Order

This type holds the information about a BrickLink order

Picture

This value type represents a picture of a BrickLink item

PriceGuide

This value type represents the price guide for a BrickLink item

In addition to that, printing extensions also use these types:

PrintJob

An instance of this type represents an active print job

PrintPage

An instance of this type represents the canvas of a printer page

Debugging

The JavaScript environment is very similiar to a web browser, so any console.log() calls end up in BrickStore's developer console, which is available via the Extras > Developer Console menu.

This developer console also doubles as a live JavaScript console, so you can test your code snippets directly there in an interactive environment.

If you throw an Error object, the script execution will terminate and the message property of the thrown object will be shown to the user in a message box.

© 2004-2024 Robert Griebl. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. All trademarks are property of their respective owners.