-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many changes in this version Most notably is a SD/USB blind install option Also support for packages developed by other users Moved package version infomation and GitHub updates from GuiMods to this package
- Loading branch information
Showing
39 changed files
with
3,767 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# DbusSettingsResources for SetupHelper | ||
# | ||
# contains a functions and variables necessary to access dbus Settings parameters | ||
# it should be sourced by scripts setting, creating and removing dbus settings | ||
# | ||
# dbus Settings is not operational during system boot when some setup scripts may | ||
# need to make settings changes | ||
# These functions check to see if the settings system is operational and defer | ||
# the set/create/remove activity so the calling script may continue | ||
|
||
source "/data/SetupHelper/EssentialResources" | ||
source "/data/SetupHelper/LogHandler" | ||
|
||
# dbus Settings funcitons | ||
# These functions encapsulate an interface to dbus Settings | ||
# NOTE: dbus Settings resources are not always active when it is necessary for | ||
# scripts to make changes or create/remove settings | ||
# it is up to the caller to insure dbus Settings resources are active before callling | ||
# these functions | ||
# a dbus exeption error will be logged if settings are not active yet | ||
|
||
|
||
# updateDbusStringSetting updates a dbus setting STRING parameter with a new value | ||
# if the setting does not exist, it is created | ||
# | ||
# functions for other data types have not been included but could be added | ||
# the determining factor is the values supplied for default, max and min values | ||
# as they determine the underlying data type for the setting | ||
# | ||
# $1 is the path to the setting starting with /Settings | ||
# $2 is the new value | ||
# | ||
# if the setting does not yet exist, it is created, then updated to the new value | ||
|
||
updateDbusStringSetting () | ||
{ | ||
local oldValue | ||
|
||
oldValue=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings "$1"\ | ||
com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $2}') | ||
if [ -z $oldValue ]; then | ||
logMessage "creating dbus Setting $1" | ||
dbus -y com.victronenergy.settings / AddSettings "%[ {\"path\":\"$1\", \"default\":\"\"} ]" &> /dev/null | ||
fi | ||
|
||
dbus -y com.victronenergy.settings "$1" SetValue "$2" &> /dev/null | ||
} | ||
|
||
|
||
updateDbusIntSetting () | ||
{ | ||
local oldValue | ||
|
||
oldValue=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings "$1"\ | ||
com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $2}') | ||
if [ -z $oldValue ]; then | ||
logMessage "creating dbus Setting $1" | ||
dbus -y com.victronenergy.settings / AddSettings "%[ {\"path\":\"$1\", \"default\":0} ]" &> /dev/null | ||
fi | ||
|
||
dbus -y com.victronenergy.settings "$1" SetValue "$2" &> /dev/null | ||
} | ||
|
||
|
||
# removeDbusSetting removes the setting from dbus Settings | ||
# | ||
# $1 is the path to the setting to be removed starting with /Settings | ||
|
||
removeDbusSetting () | ||
{ | ||
logMessage "removing dbus Setting $1" | ||
dbus -y com.victronenergy.settings / RemoveSettings "%[\"$1\" ]" &> /dev/null | ||
} | ||
|
||
|
||
# setSetting updates the dbus setting parameter | ||
# the setting must already exist or the update will fail | ||
# | ||
# $1 is the new value | ||
# $2 is the setting path | ||
|
||
setSetting () | ||
{ | ||
dbus -y com.victronenergy.settings $2 SetValue $1 &> /dev/null | ||
} | ||
|
||
# move a setting from setup options or from previous dbus Setting | ||
# $1 is the setup options path | ||
# $2 is the old dbus path | ||
# $3 is the new dbus path | ||
# dbus paths start with /Settings | ||
# if specified, the setup option file must include a value | ||
# that value has priority over the old dbus parameter | ||
|
||
moveSetting () | ||
{ | ||
local setupOption="$1" | ||
local oldDbusPath=$2 | ||
local newDbusPath=$3 | ||
if [ -f "$setupOption" ]; then | ||
oldSetting=$(cat "$setupOption") | ||
elif [ ! -z "$oldDbusPath" ]; then | ||
oldSetting=$(dbus-send --system --print-reply=literal --dest=com.victronenergy.settings\ | ||
$oldDbusPath com.victronenergy.BusItem.GetValue 2> /dev/null | awk '{print $3}') | ||
else | ||
oldSetting="" | ||
fi | ||
if [ ! -z $oldSetting ] && [ ! -z "$newDbusPath" ]; then | ||
dbus -y com.victronenergy.settings $newDbusPath SetValue $oldSetting &> /dev/null | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import QtQuick 1.1 | ||
import com.victron.velib 1.0 | ||
import "utils.js" as Utils | ||
|
||
MbItem { | ||
id: root | ||
///////////// height: 30 | ||
|
||
property int versionIndex | ||
property string bindPrefix | ||
|
||
function getBind(param) | ||
{ | ||
return Utils.path(bindPrefix, "/", versionIndex, "/", param) | ||
} | ||
|
||
VBusItem { id: packageName; bind: getBind ("PackageName") } | ||
VBusItem { id: packageVersion; bind: getBind ("PackageVersion") } | ||
|
||
MbItemValue | ||
{ | ||
description: packageName.valid ? packageName.value : "" | ||
item.bind: getBind ("PackageVersion") | ||
show: item.valid && packageName.valid | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/////// new menu for package version display | ||
|
||
import QtQuick 1.1 | ||
import "utils.js" as Utils | ||
import com.victron.velib 1.0 | ||
|
||
MbPage { | ||
id: root | ||
title: qsTr("Package Versions") | ||
property string bindPrefix: "com.victronenergy.settings/Settings/GuiMods" | ||
VBusItem { id: checkingPackageItem; bind: Utils.path(bindPrefix, "/CheckingPackage") } | ||
property string checkingPackage: checkingPackageItem.valid ? checkingPackageItem.value : "" | ||
|
||
model: VisualItemModel | ||
{ | ||
MbSubMenu | ||
{ | ||
description: qsTr("Package Version List") | ||
subpage: Component { PageSettingsPackageVersions {} } | ||
} | ||
MbItemOptions | ||
{ | ||
id: autoUpdate | ||
description: qsTr ("Automatic Git Hub updates") | ||
bind: Utils.path (bindPrefix, "/GitHubAutoUpdate") | ||
possibleValues: | ||
[ | ||
MbOption { description: "Normal"; value: 1 }, | ||
MbOption { description: "Fast one pass then Normal"; value: 2 }, | ||
MbOption { description: "Check packages once (Fast)"; value: 3 }, | ||
MbOption { description: "Disabled"; value: 0 } | ||
] | ||
writeAccessLevel: User.AccessUser | ||
} | ||
MbItemText | ||
{ | ||
text: checkingPackage | ||
wrapMode: Text.WordWrap | ||
horizontalAlignment: Text.AlignHCenter | ||
show: checkingPackage != "" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/////// new menu for package version display | ||
|
||
import QtQuick 1.1 | ||
import "utils.js" as Utils | ||
import com.victron.velib 1.0 | ||
|
||
MbPage { | ||
id: root | ||
title: qsTr("Package Version List") | ||
property string bindPrefix: "com.victronenergy.settings/Settings/PackageVersion" | ||
property VBusItem count: VBusItem { bind: Utils.path(bindPrefix, "/Count") } | ||
|
||
model: count.valid ? count.value : 0 | ||
delegate: Component | ||
{ | ||
MbDisplayPackageVersion | ||
{ | ||
bindPrefix: root.bindPrefix | ||
versionIndex: index | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/opt/victronenergy/gui/qml/PageSettings.qml |
Oops, something went wrong.