Extensions as packaged file

文件资料 •

Packaged  Banana Accounting files (.sbaa), are files that are used for extensions. You can use .sbaa file to package complex extensions, that include:

  • javascript files (.js).
  • stylesheets files (.css).
  • image files (.png, or .jpg).
  • qml files
  • any other files you need for your extensions.

This is how it works:

  • The .sbaa Extension needs to be installed through the Manage Extensions command.
  • Once the Extension is installed, it appears in the menu Extensions.
  • The Extension can be run from the menu Extensions.

Use files included in the package

Javascript files in packages can include other javascript files in the same package using the directive @includejs or the method  Banana.include(fileName). It is not possibile to include files outside the package.

// Include a script via @includejs attribute
// @includejs = somescript.js"  

// Include a script via Banana.include() method

Create a package file

Steps necessary to create a .sbaa package file;

  • Create a manifest.json file with the information regarding the extensions.
  • Create a .qrc file with the list of the files to be included in the packages.
  • Open Banana Accounting
  • Drag the .qrc file in Banana Accounting to create a package:
    • It will ask you if you want to compile the file.
    • It will generate a .sbaa file, using the rcc command.

Qrc file file can also be compiled with the QT command

Manifest file

If you create a .sbaa file, also include a manifest file. The manifest.json file is a JSON-formatted file, which you can include in the .sbaa file through the .qrc file.
Using manifest.json, you specify basic metadata about your package such as the title, description and version.
The file name must end with the extension 'manifest.json'

Example: ch.banana.script.report.vat-ch.manifest.json

    "category": "import",
    "description": "Postfinance Schweiz (Bewegungen importieren): ISO20022 und CSV Format",
    "description.en": "Swiss Postfinance (Import transactions): ISO20022 and CSV File Format",
    "publisher": "Banana.ch",
    "title": "Postfinance Schweiz (Bewegungen importieren)",
    "title.en": "Swiss Postfinance (Import transactions)",
    "version": "1.0"
  • Available categories: export, import, invoice, invoice reminder, invoice statement, productivity. 
    If you don't specify the category ("category": ""), the program will take the category from the first app included in the package. If you don't specify country or language, the app will be shown for any country or language.
  • All tags are optional

QRC resource file (.qrc)

Resource Collection Files (QRC) specify the content of the packaged file.
For more information see the Qt Resource system.

Example: ch.banana.script.report.jaml.qrc

<!DOCTYPE RCC><RCC version="1.0">

RCC file using the alias keyword:

<!DOCTYPE RCC><RCC version="1.0">
    <file alias="manifest.json">ch.banana.script.report.vat-ch.manifest.json</file>






    分享这篇文章: Twitter | Facebook | LinkedIn | Email