Fixing a LOT of issues stemming from X cursor
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
92594f5af3
commit
0075c03c9d
6 changed files with 50 additions and 20 deletions
|
@ -224,8 +224,6 @@ ApplicationWindow {
|
|||
settings.linewidth = data["linewidth"]
|
||||
if("textsize" in data)
|
||||
settings.textsize = data["textsize"]
|
||||
if("history" in data)
|
||||
history.unserialize(...data["history"])
|
||||
root.height = data["height"]
|
||||
root.width = data["width"]
|
||||
|
||||
|
@ -242,6 +240,11 @@ ApplicationWindow {
|
|||
error += qsTr("Unknown object type: %1.").arg(objType) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Importing history
|
||||
if("history" in data)
|
||||
history.unserialize(...data["history"])
|
||||
|
||||
// Refreshing sidebar
|
||||
if(sidebarSelector.currentIndex == 0) {
|
||||
// For some reason, if we load a file while the tab is on object,
|
||||
|
|
|
@ -179,9 +179,13 @@ D.Dialog {
|
|||
icon: visible ? `icons/settings/custom/${parent.label}.svg` : ''
|
||||
// True to select an object of type, false for enums.
|
||||
property bool selectObjMode: paramTypeIn(modelData[1], ['ObjectType'])
|
||||
property bool isRealObject: !selectedObj || (modelData[1].objType != "ExecutableObject" && modelData[1].objType != "DrawableObject")
|
||||
|
||||
property var baseModel: visible ?
|
||||
(selectObjMode ? Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(modelData[1].objType)]) : modelData[1].values)
|
||||
(selectObjMode ? Objects.getObjectsName(modelData[1].objType)
|
||||
.concat(
|
||||
isRealObject ? [qsTr("+ Create new %1").arg(modelData[1].objType)] : [])
|
||||
: modelData[1].values)
|
||||
: []
|
||||
// Translate the model if necessary.
|
||||
model: selectObjMode ? baseModel : baseModel.map(x => qsTr(x))
|
||||
|
@ -193,16 +197,20 @@ D.Dialog {
|
|||
// This is only done when what we're selecting are Objects.
|
||||
// Setting object property.
|
||||
var selectedObj = Objects.getObjectByName(baseModel[newIndex], modelData[1].objType)
|
||||
if(selectedObj == null) {
|
||||
// Creating new object.
|
||||
selectedObj = Objects.createNewRegisteredObject(modelData[1].objType)
|
||||
history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, modelData[1].objType, selectedObj.export()))
|
||||
baseModel = Objects.getObjectsName(modelData[1].objType).concat([qsTr("+ Create new %1").arg(Objects.types[modelData[1].objType].displayType())])
|
||||
currentIndex = baseModel.indexOf(selectedObj.name)
|
||||
if(newIndex != 0) {
|
||||
// Make sure we don't set the object to null.
|
||||
if(selectedObj == null) {
|
||||
// Creating new object.
|
||||
selectedObj = Objects.createNewRegisteredObject(modelData[1].objType)
|
||||
history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, modelData[1].objType, selectedObj.export()))
|
||||
baseModel = Objects.getObjectsName(modelData[1].objType).concat(
|
||||
isRealObject ? [qsTr("+ Create new %1").arg(modelData[1].objType)] : [])
|
||||
currentIndex = baseModel.indexOf(selectedObj.name)
|
||||
}
|
||||
selectedObj.requiredBy.push(Objects.currentObjects[objEditor.objType][objEditor.objIndex])
|
||||
//Objects.currentObjects[objEditor.objType][objEditor.objIndex].requiredBy = objEditor.obj[modelData[0]].filter((obj) => objEditor.obj.name != obj.name)
|
||||
}
|
||||
//Objects.currentObjects[objEditor.objType][objEditor.objIndex].requiredBy = objEditor.obj[modelData[0]].filter((obj) => objEditor.obj.name != obj.name)
|
||||
objEditor.obj.requiredBy = objEditor.obj.requiredBy.filter((obj) => objEditor.obj.name != obj.name)
|
||||
selectedObj.requiredBy.push(Objects.currentObjects[objEditor.objType][objEditor.objIndex])
|
||||
history.addToHistory(new HistoryLib.EditedProperty(
|
||||
objEditor.obj.name, objEditor.objType, modelData[0],
|
||||
objEditor.obj[modelData[0]], selectedObj
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
.pragma library
|
||||
|
||||
.import "objects.js" as Objects
|
||||
.import "objs/common.js" as Common
|
||||
.import "utils.js" as Utils
|
||||
.import "mathlib.js" as MathLib
|
||||
|
||||
|
@ -106,8 +107,17 @@ class EditedProperty extends Action {
|
|||
this.previousValue = previousValue
|
||||
this.newValue = newValue
|
||||
if(valueIsExpressionNeedingImport) {
|
||||
this.previousValue = new MathLib.Expression(this.previousValue);
|
||||
this.newValue = new MathLib.Expression(this.newValue);
|
||||
if(targetType == "Expression") {
|
||||
this.previousValue = new MathLib.Expression(this.previousValue);
|
||||
this.newValue = new MathLib.Expression(this.newValue);
|
||||
} else if(targetType == "Domain") {
|
||||
this.previousValue = MathLib.parseDomain(this.previousValue);
|
||||
this.newValue = MathLib.parseDomain(this.newValue);
|
||||
} else {
|
||||
// Objects
|
||||
this.previousValue = Objects.getObjectByName(this.previousValue);
|
||||
this.newValue = Objects.getObjectByName(this.newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,6 +132,9 @@ class EditedProperty extends Action {
|
|||
export() {
|
||||
if(this.previousValue instanceof MathLib.Expression) {
|
||||
return [this.targetName, this.targetType, this.targetProperty, this.previousValue.toEditableString(), this.newValue.toEditableString(), true]
|
||||
} else if(this.previousValue instanceof Common.DrawableObject) {
|
||||
return [this.targetName, this.targetType, this.targetProperty, this.previousValue.name, this.newValue.name, true]
|
||||
|
||||
} else {
|
||||
return [this.targetName, this.targetType, this.targetProperty, this.previousValue, this.newValue, false]
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ var currentObjects = {}
|
|||
|
||||
function getObjectByName(objName, objType = null) {
|
||||
var objectTypes = Object.keys(currentObjects)
|
||||
if(typeof objType == 'string') {
|
||||
if(typeof objType == 'string' && objType != "") {
|
||||
if(objType == "ExecutableObject") {
|
||||
objectTypes = getExecutableTypes()
|
||||
} else if(currentObjects[objType] != undefined) {
|
||||
|
@ -37,12 +37,14 @@ function getObjectByName(objName, objType = null) {
|
|||
}
|
||||
if(Array.isArray(objType)) objectTypes = objType
|
||||
var retObj = null
|
||||
objectTypes.forEach(function(objType){
|
||||
if(currentObjects[objType] == undefined) return null
|
||||
currentObjects[objType].forEach(function(obj){
|
||||
if(obj.name == objName) retObj = obj
|
||||
if(objName != "" && objName != null) {
|
||||
objectTypes.forEach(function(objType){
|
||||
if(currentObjects[objType] == undefined) return null
|
||||
currentObjects[objType].forEach(function(obj){
|
||||
if(obj.name == objName) retObj = obj
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
return retObj
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,10 @@ class DrawableObject {
|
|||
}
|
||||
|
||||
draw(canvas, ctx) {}
|
||||
|
||||
toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
class ExecutableObject extends DrawableObject {
|
||||
|
|
|
@ -6,7 +6,7 @@ bash release.sh
|
|||
cd ../../
|
||||
|
||||
# Deb
|
||||
python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \
|
||||
sudo python3 setup.py --remove-git-version --command-packages=stdeb.command sdist_dsc \
|
||||
--package logarithmplotter --copyright-file linux/debian/copyright --suite impish --depends3 "$(cat linux/debian/depends)" --section science \
|
||||
bdist_deb
|
||||
|
||||
|
|
Loading…
Reference in a new issue