Prima::VB::CfgMaint - configures the widget palette in the Visual Builder
The module is used by the Visual Builder and prima-cfgmaint programs, to configure the Visual Builder widget palette. The installed widgets are displayed in the main panel of the Visual Builder and can be maintained by the prima-cfgmaint program.
prima-cfgmaint
The widget palette configuration is contained in two files - the system-wide Prima::VB::Config and the user ~/.prima/vbconfig. The user config file takes precedence when loaded by the Visual Builder. The module can select either configuration by assigning the $systemWide boolean property.
Prima::VB::Config
~/.prima/vbconfig
$systemWide
The widgets are grouped in pages which are accessible by their names.
New widgets can be added to the palette by calling the add_module method which accepts a perl module file as its first parameter. The module must conform to the VB-loadable format.
add_module
This section describes the format of a module with VB-loadable widgets.
The module must define a package with the same name as the module. In the package, the class sub must be declared, that returns an array or paired scalars, where each first item in the pair corresponds to the widget class and the second to the hash which contains the class loading information, and must contain the following keys:
class
Name of the package which represents the original widget class in the Visual Builder. This is usually a lightweight package that does not contain all the functionality of the original class but is capable of visually reflecting changes to the most useful class properties.
Sets the image file with the class icon. PATH provides an extended syntax for indicating a frame index if the image file is multiframed: the frame index is appended to the path name with the : character prefix, for example: "NewWidget::icons.gif:2".
:
"NewWidget::icons.gif:2"
Sets the module name that contains class.
Sets the default palette page where the widget is to be stored. The current implementation of the Visual Builder provides four pages: General,Additional,Sliders,Abstract. If the page is not present, a new page is automatically created when the widget class is registered there.
General,Additional,Sliders,Abstract
Sets the module name that contains the original widget class.
The reader is urged to explore Prima::VB::examples::Widgety file which contains an example class Prima::SampleWidget, its VB-representation, and an example property lineRoundStyle.
Prima::SampleWidget
lineRoundStyle
Reads the FILE module and loads all VB-loadable widgets from it.
Returns declaration of all registered classes as a string ( see "FORMAT" ).
Loads class and pages information from either the system-wide or the user configuration file. If succeeds, the information is stored in the @pages and %classes variables ( the old information is lost ) and returns 1. If fails, returns 0 and a string with the error explanation; @pages and %classes content is undefined.
@pages
%classes
Returns an array of page names
Reads information from both the system-wide and user configuration files and merges the information. If succeeds, returns 1. If fails, returns 0 and a string with the error explanation.
Erases all information about pages and classes.
Writes either the system-wide or the user configuration file. If the $backup flag is set to 1, the old file is renamed to a .bak file. If succeeds, returns 1. If fails, returns 0 and a string with the error explanation.
$backup
.bak
Prima::VB::Config.pm, ~/.prima/vbconfig.
Dmitry Karasik, <dmitry@karasik.eu.org>.
VB, prima-cfgmaint, Prima::VB::examples::Widgety.
To install Prima, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima
CPAN shell
perl -MCPAN -e shell install Prima
For more information on module installation, please visit the detailed CPAN module installation guide.