新一个版本的Maqetta发布了,最新的版本是8,由于自从版本7,Maqetta的架构发生了很大的变化,其和Orion进行了集成,因此一些实现原理等发生了变化,这里对其自定义插件的开发方式进行一个简单的说明。
1、复制一个Maqetta8现有的一个插件进行修改,比如maqetta.shapes、maqetta.clipart等,并根据自己的实际需要进行仔细修改;
2、修改widgetPalette.json(重点),其位于davinci.releng/orion/builder/siteConfig/目录下
首先,在"defs"里定义自己的widgets库所要显示的插件,如:
"$CustomUISection":{
"id":"CustomUI",
"name": "Custom UI",
"iconBase64": "data:image/gif;base64,R0lGODlhEAAQAKIAAL+/v5aWlmNjYzMzMxwcHBYWFv///wAAACH5BAEAAAYALAAAAAAQABAAAAMgaLrc/jBKFsBcg9g7iuaFZwlhaZrD1Ikqq35Xdc10PScAOw==",
"includes":[
"Message",
"Share",
"WeatherButton",
"WeatherInput",
"WeatherResult"
]
},
还可以根据实际需要,对同一个widgets库下的widget进行分类显示
其次,定义自己的插件要在那些应用程序里显示,如
"$mobileSections":[
"$ViewsSection",
"$HeadingSection",
"$ListsSection",
"$ControlsSection",
"$ContainersSection",
"$HTMLSection",
"$ClipartSection",
"$DrawingToolsSection",
"$DrawingNewToolsSection",
"$AppOtherSection"
],
"$desktopSections":[
"$ContainersSection",
"$ControlsSection",
"$ViewsSection",
"$HeadingSection",
"$ListsSection",
"$HTMLSection",
"$ClipartSection",
"$DrawingToolsSection",
"$DrawingNewToolsSection",
"$CustomUISection",
"$AppOtherSection"
],
最后,在"presets"定义自己的自定义widget要显示在开发界面上的组件库,如
"desktop":{
"collections":[
{ "id":"dijit", "show":true },
{ "id":"dojoxmobile", "show":false },
{ "id":"html", "show":true },
{ "id":"clipart", "show":true },
{ "id":"shapesnew", "show":true },
{ "id":"customui", "show":true },
{ "id":"shapes", "show":true }
],
"sections":"$desktopSections"
},
3、把自定义的组件加入到maqetta.orion.feature插件里的feature.xml文件中
至此,Maqetta8里的自定义插件顺利完成,启动后,就可以在界面看到自定义的widgets