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
Banana.include(somescript.js);

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",
    "country":"switzerland",
    "countryCode":"ch",
    "description": "Postfinance Schweiz (Bewegungen importieren): ISO20022 und CSV Format",
    "description.en": "Swiss Postfinance (Import transactions): ISO20022 and CSV File Format",
    "language":"de",
    "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">
<qresource>
     <file>manifest.json</file>
     <file>ch.banana.script.report.jaml.js</file>
     <file>lib/jaml-all.js</file>
</qresource>
</RCC>

RCC file using the alias keyword:

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

 

     

    请帮助我们完善必备文件

    我们非常欢迎您发送宝贵的反馈意见

    请告诉我们什么主题需要更好的解释或如何才能更好的对其诠释。

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