Porting from LogicView2

From Axel Public Wiki
Revision as of 18:25, 16 March 2022 by Axelpwiki (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Porting procedure from LogicView2 1.4.0.x to SoftTune 1.6.0.x :

Here follows some operations to do on the SetupKit to use SoftTune redistributable file instead of LogicView2 redistributable files. Customizations (configurator name, extension, splash ecc) can then be applied in the same ways as old LogicView2

  • Backup

Backup SetupKit folder, procedures requires different steps so it is better to save a copy

  • Rename files

1) LogicView2.pct to SoftTune.pct

2) LogicView2.js to SoftTune.js

  • Update SetupKit with SoftTune redist file

Download and unzip into configurator folder SoftTune_Redist_1.5.0.x_yymmdd.zip

NB: for retrocompatibility a "LogicView2.pct" that simply includes "SoftTune.pct" file will be automatically added to SetupKit

  • Update SoftTune.pct

1) In SoftTune.pct search "LogicView2" and replace it with "SoftTune"

2) Update schema version from "1.0" to "2.0"

<datadef version="2.0">

3) Add "subidx" definition in Tvalue:

<xs:complexType name="Tvalue">
	<xs:simpleContent>
		<xs:extension base="xs:string">
			<xs:attribute name="ipa" type="xs:integer"/>
			<xs:attribute name="defval" type="xs:string" />
			<xs:attribute name="subidx" type="xs:integer" />
		</xs:extension>
	</xs:simpleContent>
</xs:complexType>

4) Add "subidx" definition in Trecipe:

<xs:complexType name="Trecipe">
	<xs:sequence minOccurs="0" maxOccurs="unbounded">
		<xs:element name="value">
			<xs:complexType>
				<xs:simpleContent>
					<xs:extension base="xs:string">
						<xs:attribute name="ipa" type="xs:integer"/>
						<xs:attribute name="subidx" type="xs:integer"/>
						<xs:attribute name="ondeletenode" type="xs:string" fixed="configurator.OnDeleteRecipeNode"/>
					</xs:extension>
				</xs:simpleContent>
			</xs:complexType>
		</xs:element>
	</xs:sequence>
	<xs:attribute name="ipa" type="xs:integer"/>
	<xs:attribute name="caption" type="xs:string"/>
	<xs:attribute name="hasDatalink" type="xs:boolean" fixed="true"/>
	<xs:attribute name="insertable" type="xs:boolean" default="true"/>
	<xs:attribute name="DeleteElementFunc" type="xs:string" fixed="configurator.DeleteRecipe"/>
</xs:complexType>

5) add "stopNodeParsing" in "TgenericConfig"

<xs:complexType name="TgenericConfig">
	<xs:sequence>
		<xs:element name="commstring" type="xs:string"/>
		<xs:element name="values">
			<xs:complexType>
				<xs:sequence minOccurs="0" maxOccurs="unbounded">
					<xs:element name="value"  type="Tvalue"/>
				</xs:sequence>
				<xs:attribute name="stopNodeParsing" type="xs:boolean" fixed="true" />
			</xs:complexType>
		</xs:element>
		<xs:element name="commDisabled" type="xs:boolean"/>
	</xs:sequence>
</xs:complexType>

6) switch to AlCatalogManager5 interface <com alias="catalog" persistent="true">AlCatalogManager5.CatalogInterface</com>

  • Update SoftTune.js

In UpgradeNode function add manage oldVersion < 2.0 templates

function UpgradeNode(root, oldVersion)
{
	var xmldoc = app.GetXMLDocument()
	
	if (oldVersion < 2.0)
	{
		// aggiunge sottoindice a 0 anche a recipe
		var nodelist = root.selectNodes("data/*/config/values/value | data/*/recipes/recipe/value")
		var node
		while (node = nodelist.nextNode())
			node.setAttribute("subidx", 0)
	}
}
  • Update other *.js *.html

Search "LogicView2" and replace it with "SoftTune" in all *.js *.html files where it is used as an "extension" keyword

ES: app.CallFunction( "LogicView2.func" ) to app.CallFunction( "SoftTune.func" )

  • Add Configurator_root protocol

Update [youTarget].pct device files into Catalog folder adding "<protocol>Configurator_root</protocol>" in <protocols> node

  • Update common.js

Update [SetupKit]\Common\Script\common.js files with these function definitions required by maingrid.js:

function GridLoadSettings_byColNames(grid, gridName, columns)
{
	for (var colName in columns)
	{
		var colIdx = columns[colName];

		var width = app.ReadINIString(INI_GRIDSETTINGS_PREFIX + gridName, INI_COLWIDTH_PREFIX + "_" + colName, "-1")
		if (width == -1)
			return   // se valore non trovato in ini esce subito, inutile proseguire a cercare anche le altre colonne

		// imposta la dimensione della colonna letta da file solo se la colonna non è già nascosta
		if (grid.ColWidth(colIdx) != 0)
			grid.ColWidth(colIdx) = width
	}
}
function GridSaveSettings_byColName(grid, gridName, columns, originalColumnsWidth)
{
	// effettua salvataggio solo se le colonne sono effettivamente state modificate
	if (!m_gridColumnsChanged)
		return
	
	for (var colName in columns)
	{
		var colIdx = columns[colName];

		// se la colonna era originariamente nascosta non ne salva la dimensione
		if (originalColumnsWidth && originalColumnsWidth[colIdx] == 0)
			continue

		var width = grid.ColWidth(colIdx)
		app.WriteINIString(INI_GRIDSETTINGS_PREFIX + gridName, INI_COLWIDTH_PREFIX + "_" + colName, width)
	}
}
  • Update CSS

If not defined in Common\CSS\style.css, please add these definitions

 .fill-height-container {
   height: 100%;
   display: -ms-flexbox;
   display: flex;
   -ms-flex-direction: column;
       flex-direction: column;
 }
 .fill-height-container-row {
   height: 100%;
   display: -ms-flexbox;
   display: flex;
   -ms-flex-direction: row;
       flex-direction: row;
 }
 .fill-height {
   /* workaround vecchi browser*/
   display: block;
   height: 100%;
   /* nuovi browser con modalit� flex */
   -ms-flex: 1;
       flex: 1;
 }
  • Required files

Add to Setup\Shared folder these files

- Shared\redist\2017\vc_redist.x86.exe

- AlCatalogManager5.dll

- ToolkitPro1850vc150U.dll

  • Update ISS

1) Add this line in the ISS file at the very beginning of the [Files] section

[Files]
; ------------------------------Visual C++ 2017 x86 Redistributable Package----------------------------------
Source: Shared\redist\2017\vc_redist.x86.exe; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: RunSetup('Installing Visual C++ 2017 Redistributable...', '/install /quiet /norestart')

2) Add these lines in the ISS file into the [Files] section

Source: shared\AlCatalogManager5.dll; DestDir: {cf}\AlComponents; Flags: regserver sharedfile uninsneveruninstall
Source: Shared\ToolkitPro1850vc150U.dll; DestDir: "{sys}"; Flags: sharedfile

3) Add this procedure on the [Code] section

procedure RunSetup(msg : String; params : String);
var
 ResultCode: Integer;
 begin
  if (Exec(ExpandConstant(CurrentFileName), params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode)) then
   begin
    // handle success if necessary; ResultCode contains the exit code
   end
   else begin
        MsgBox('Error '+ msg + '. Please retry or contact system administrator. '+ SysErrorMessage(ResultCode), mbError, MB_OK);
        WizardForm.Close;
    // handle failure if necessary; ResultCode contains the error code
   end;
end;
  • Update make custom version file

Replace reference to "LogicView2" as "SoftTune"

es: in LVMakeCustomVersion.bat file

set SRC=%BUILDPATH%\SoftTune.exe"

Porting procedure to SoftTune 1.8.0.x :

  • Update SofTune.PCT

Declare this new window on hmi section

<form type="html" link="ExportSettings.html" xsize="280" ysize="420" modal="true">ExportSettings</form>

Search for command "Export to text file..." (if not present create a new one) and change both handler and update handler functions

<command caption="Export to text file..." handler="configurator.ExportParametersToCSV" updatehandler="configurator.OnUpdateExportParametersToCSV" statusmsg="Export device parameters to CSV file" />

Remove "File comparison" command (usually in Service menu):

<command caption="&File comparison" handler="configurator.FileComparison" updatehandler="configurator.Update_FileComparison" statusmsg="Compare current file values with other file"/>

Declare this new window on hmi section

<form type="html" link="CompareParameters.html" modal="true" toolWindow="true" resizable="true" xsize="670" ysize="630" icon="img\main.ico">CompareParameters</form>

Add "Compare parameters" command (recommended before "Search parameters..." command in Parameters menu)

<command caption="Compare parameters..." handler="configurator.OnCompareParameters" updatehandler="configurator.UpdateOnCompareParameters" statusmsg="Compare online, with default or with file" />


Porting procedure to SoftTune 1.10.0.x :

  • SoftTune.pct must be updated to include persistentVariables definition

Also schema definition must be incremented, and UpgradeNode() in SoftTune.js must handle to upgrade, to add persistentVariables node

Porting procedure to SoftTune 1.11.0.x :

  • With the resolution of ST-80: "Start of auto-refresh with large grids is slow", in custom pseudo-grid pages (see IsGridPage() in configurator.js) the function GetAllParameters and GetSelection must be adapted to the new interface (see maingrid.js)