Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Vi Next notes

XeoN-GHMB edited this page Dec 23, 2020 · 21 revisions

EntryActions

To add actions to the second actionbar use the key entryAction in the adminInfo

"entryActions":[ "preview" ],

Tree / Hierarchy / File / Browser Handler

There are different ways to display a hierarchy or a tree.

The display is controlled by the handler in the adminInfo. The following values are valid.

  • tree: default tree widget
  • tree.file and tree.simple.file: a step by step navigation through the tree with file leafs
  • tree.browser: step-by-step navigation through the tree
  • tree.hierarchy: like default tree widget but without leafs

Config flow

  • Python from vi.config import conf now returns the flare config
  • the Adminscreen init overrides the flare config with projectspecific configurations
  • to inject further complex data use the bindApp function in flare.init.py.

Porting

imports

  • html5.ext.popup > flare.popup
  • html5.ignite.Input > flare.input import Input
  • html5.ignite.Table > flare.ignite import Table
  • html5.utils > flare.utils
  • YesNoDialog > flare.popup import Confirm
  • InputDialog > flare.popup import Prompt
  • from vi import html5 > from flare import html5
  • vi.i18n > flare.i18n
  • vi.network > flare.Network
  • priorityqueue > vi.priorityqueue
  • from vi.framework.components.button import Button > from flare.button import Button
  • from config import conf > from vi.config import conf

Porting a simple action Plugin

  • replace imports
  • remove old css classes like "icon"
  • add new css Classes: ["btn","bar-item", "btn--small"]
    • optional additional classes: btn--primary, btn--add, btn--edit, btn--danger, btn--viur
  • add an Icon to the Button:
    • add icon="icon-XX" to the Button super-call

Panes

BREAKING: Has been removed

Porting: Needs to be rebuilt with Flare views.

Example: EditPane to EditView

###create a pane
pane = EditPane(translate("Add"), closeable=True, iconURL="icon-add",iconClasses=["modul_%s" % self.parent().parent().module, "apptype_list", "action_add" ])
###add a pane
conf["mainWindow"].stackPane( pane )
###create a widget
edwg = EditWidget(self.parent().parent().module, EditWidget.appList, context=self.parent().parent().context)
###add a widget to pane
pane.addWidget( edwg )

With views we now have an editView which always contains the edit widget. (/views/edit)

conf["mainWindow"].openNewMainView(
		translate( "Add" ), 			          #displayname
		"icon-add", 					  #icon
		"edithandler",					  #viewname edithandler can be used for add and edit action
		self.parent().parent().module,	                  #modulename 
		"add",						  #action
		data = {"context":self.parent().parent().context} #here we transfer needed data to the new view
	)

Flare Next

Views

A view consists of a View class, which is responsible for the registration of the logic and the ViewWidget class, which is responsible for the display.

helpers

registerViews takes a path parameter. All View Classes underneath this folder are registered

e.g. registerViews(os.path.join(root,"views"))

addView register a single View. The first parameter is the view Class which should be registered. The second optional parameter overrides the view name.

addView(exampleClass)

generateView overrides the view name and build Classlevel parameters. Parameters (view,moduleName,actioName,name=None, data=())

generateView(handlerCls,moduleName,handler,data=moduleInfo)

Icon Class

BREAKING: removed embedsvg and icon parameter

Porting: rename embedsvg and icon to value

NEW: added fallbackIcon parameter

If the icon cannot be loaded, the fallback icon is used. It must be a SVG

NEW: added title parameter

Will be written to the element

NEW: added classes parameter

Must be a list of classes to be used additionally

Noci Class

BREAKING: Has been removed

Porting: for icons with svg, jpg or fileBone use the new icon class If you need badges, use the new BadgeIcon class provided by Icon

SvgIcon Class

NEW: For a raw svg use the class SVIcon, the value could be a svgname or a svgpath.