From 12fe9286464381e92b084913e6f2b08af30e95a1 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:48:09 +0530 Subject: [PATCH 1/9] manifest: Bump to BaseApp 23.06 and Gnome 44 --- org.sugarlabs.Physics.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index 2fa87d7..0c0dea4 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -1,9 +1,9 @@ { "app-id": "org.sugarlabs.Physics", "base": "org.sugarlabs.BaseApp", - "base-version": "21.04", + "base-version": "23.06", "runtime": "org.gnome.Platform", - "runtime-version": "40", + "runtime-version": "44", "sdk": "org.gnome.Sdk", "separate-locales": false, "command": "sugarapp", From d067c4286a2eac8523f33a4ace940eb890158645 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:50:07 +0530 Subject: [PATCH 2/9] manifest: Update and Apply flatpak-external-data-checker to box2d --- org.sugarlabs.Physics.json | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index 0c0dea4..e5ad0d4 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -37,17 +37,23 @@ }, { "name": "box2d", - "buildsystem": "simple", - "build-commands": [ - "pip3 install --no-index --find-links \"file://${PWD}\" --prefix=${FLATPAK_DEST} box2d" - ], - "sources": [ - { - "type": "file", - "url": "https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz", - "sha256": "d1557dffdf9c1d6c796ec5df53e3d93227bb026c14b8411d22c295edaa2fb225" - } - ] + "buildsystem": "simple", + "build-commands": [ + "python3 setup.py build_ext --inplace", + "pip3 install --no-index --find-links \"file://${PWD}\" --prefix=${FLATPAK_DEST} ." + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/pybox2d/pybox2d.git", + "tag": "2.3.10", + "commit": "ed9d7b04f7099a15984c727dbce46c13abd64409", + "x-checker-data": { + "type": "git", + "tag-pattern": "^([\\d.]+)$" + } + } + ] }, { "name": "physics", From c354c56d3b4275addfe13d415c1b4b1625146cc4 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:51:31 +0530 Subject: [PATCH 3/9] manifest: Update and Apply flatpak-external-data-checker to pygame --- org.sugarlabs.Physics.json | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index e5ad0d4..bf26793 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -24,6 +24,42 @@ ], "modules": [ "shared-modules/pygame/pygame-1.9.4.json", + { + "name": "pygame2", + "sources": [ + { + "type": "archive", + "url": "https://files.pythonhosted.org/packages/59/2a/cf94cd20b993baa764e3e7eae9e7084ca2d04c5e3f74eacf8f1ea62d9be9/pygame-2.5.0.tar.gz", + "sha256": "edd5745b79435976d92c0a7318aedcafcb7ac4567125ac6ba88aa473559ef9ab", + "x-checker-data": { + "type": "pypi", + "name": "pygame" + } + } + ], + "buildsystem": "simple", + "build-commands": [ + "pip3 install --ignore-installed --no-deps --prefix=/app ." + ], + "build-options": { + "env": { + "PORTMIDI_INC_PORTTIME": "1", + "PYGAME_EXTRA_BASE": "/app" + }, + "arch": { + "aarch64": { + "env": { + "ORIGLIBDIRS": "/lib:/lib64:/lib/aarch64-linux-gnu" + } + }, + "x86_64": { + "env": { + "ORIGLIBDIRS": "/lib:/lib64:/lib/x86_64-linux-gnu" + } + } + } + } + }, { "name": "swig", "cleanup": [ "*" ], From de9f6e89f9b35dc8edb24e48a25bde6742852f26 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:52:40 +0530 Subject: [PATCH 4/9] manifest: Remove shared-modules submodule --- .gitmodules | 3 --- org.sugarlabs.Physics.json | 1 - shared-modules | 1 - 3 files changed, 5 deletions(-) delete mode 100644 .gitmodules delete mode 160000 shared-modules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1e7a990..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "shared-modules"] - path = shared-modules - url = https://github.com/flathub/shared-modules.git diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index bf26793..a3d474c 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -23,7 +23,6 @@ "/share/man" ], "modules": [ - "shared-modules/pygame/pygame-1.9.4.json", { "name": "pygame2", "sources": [ diff --git a/shared-modules b/shared-modules deleted file mode 160000 index 769d287..0000000 --- a/shared-modules +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 769d287b1a65f8b128570be11ec4626dcc608210 From 4c5cd372c3bc87867e84df923c52f8dd047f7093 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:57:09 +0530 Subject: [PATCH 5/9] manifest: Update and Apply flatpak-external-data-checker to swig --- org.sugarlabs.Physics.json | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index a3d474c..490c3e5 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -64,9 +64,14 @@ "cleanup": [ "*" ], "sources": [ { - "type": "archive", - "url": "https://github.com/swig/swig/archive/rel-3.0.8.tar.gz", - "sha256": "b00a4d54681ce0ab91d45dfbc89ebc400f4a05ba9cf217b459a521f9c0b9108e" + "type": "git", + "url": "https://github.com/swig/swig.git", + "tag": "v4.1.1", + "commit": "77323a0f07562b7d90d36181697a72a909b9519a", + "x-checker-data": { + "type": "git", + "tag-pattern": "^(?:v|rel-)([\\d.]+)$" + } } ] }, From 78a531797ef6faeec0acdf97123b984e2641822e Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 15:59:02 +0530 Subject: [PATCH 6/9] manifest: Update and add samples fix patch to activity --- org.sugarlabs.Physics.json | 10 ++----- physics-fix-load.patch | 47 --------------------------------- physics-fix-samples.patch | 54 ++++++++++++++++++++++++++++++++++++++ physics-monitors.patch | 15 +++++------ physics-port.patch | 45 ++++++++++++++----------------- 5 files changed, 83 insertions(+), 88 deletions(-) delete mode 100644 physics-fix-load.patch create mode 100644 physics-fix-samples.patch diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index 490c3e5..cc9f734 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -105,7 +105,7 @@ { "type": "git", "url": "https://github.com/sugarlabs/physics.git", - "commit": "12c5f706ad57ab236d615029021d1fc6af306bd9" + "commit": "cfd17b82b783f1ce4952ccdef6a8ddbe3d8f3e46" }, { "type": "patch", @@ -115,10 +115,6 @@ "type": "patch", "path": "physics-monitors.patch" }, - { - "type": "patch", - "path": "physics-fix-load.patch" - }, { "type": "patch", "path": "physics-fix-save.patch" @@ -138,9 +134,7 @@ "install -D activity/mimetypes.xml /app/share/mime/packages/org.sugarlabs.Physics.xml", "install -D appdata /app/share/metainfo/org.sugarlabs.Physics.appdata.xml", "install -D desktop /app/share/applications/org.sugarlabs.Physics.desktop", - "install -D activity/activity-physics.svg /app/share/icons/hicolor/scalable/apps/org.sugarlabs.Physics.svg", - "rm /app/share/sugar/activities/Physics.activity/samples/example-1.json", - "rm /app/share/sugar/activities/Physics.activity/samples/thumbnails/example-1.png" + "install -D activity/activity-physics.svg /app/share/icons/hicolor/scalable/apps/org.sugarlabs.Physics.svg" ] } ] diff --git a/physics-fix-load.patch b/physics-fix-load.patch deleted file mode 100644 index ec9737f..0000000 --- a/physics-fix-load.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/physics.py b/physics.py -index 300cf44..08eb52f 100644 ---- a/physics.py -+++ b/physics.py -@@ -109,27 +109,27 @@ class PhysicsGame: - self.world.renderer.set_surface(self.screen) - self.world.add.ground() - -- if self.opening_queue: -- path = self.opening_queue.encode('ascii', 'convert') -- if os.path.exists(path): -- self.world.json_load(path, serialized=True) -- if 'full_pos_list' in self.world.additional_vars: -- self.full_pos_list = \ -- self.world.additional_vars['full_pos_list'] -- if 'trackinfo' in self.world.additional_vars: -- self.trackinfo = self.world.additional_vars['trackinfo'] -- if 'tracked_bodies' in self.world.additional_vars: -- self.tracked_bodies = \ -- self.world.additional_vars['tracked_bodies'] -- - while self.running: -- - # Pump GTK messages. - while Gtk.events_pending(): - Gtk.main_iteration() - if not self.running: - break - -+ if self.opening_queue: -+ path = self.opening_queue.encode('ascii', 'convert') -+ if os.path.exists(path): -+ self.world.json_load(path, serialized=True) -+ if 'full_pos_list' in self.world.additional_vars: -+ self.full_pos_list = \ -+ self.world.additional_vars['full_pos_list'] -+ if 'trackinfo' in self.world.additional_vars: -+ self.trackinfo = self.world.additional_vars['trackinfo'] -+ if 'tracked_bodies' in self.world.additional_vars: -+ self.tracked_bodies = \ -+ self.world.additional_vars['tracked_bodies'] -+ self.opening_queue = None -+ - # Pump PyGame messages. - for event in pygame.event.get(): - if event.type == pygame.QUIT: - diff --git a/physics-fix-samples.patch b/physics-fix-samples.patch new file mode 100644 index 0000000..044e438 --- /dev/null +++ b/physics-fix-samples.patch @@ -0,0 +1,54 @@ +diff --git a/activity.py b/activity.py +index 0d76dcf..42eb543 100644 +--- a/activity.py ++++ b/activity.py +@@ -624,6 +624,7 @@ class PhysicsActivity(SugarCompatibleActivity): + f.close() + + self.read_file(file_path) ++ self.game.check_queue() + except: + title = _('Load project from journal') + if not journal: +diff --git a/physics.py b/physics.py +index e6128d9..debe85f 100644 +--- a/physics.py ++++ b/physics.py +@@ -87,6 +87,20 @@ class PhysicsGame: + # Loading from journal + self.opening_queue = path + ++ def check_queue(self): ++ if self.opening_queue: ++ path = self.opening_queue.encode('ascii', 'convert') ++ if os.path.exists(path): ++ self.world.json_load(path, serialized=True) ++ if 'full_pos_list' in self.world.additional_vars: ++ self.full_pos_list = \ ++ self.world.additional_vars['full_pos_list'] ++ if 'trackinfo' in self.world.additional_vars: ++ self.trackinfo = self.world.additional_vars['trackinfo'] ++ if 'tracked_bodies' in self.world.additional_vars: ++ self.tracked_bodies = \ ++ self.world.additional_vars['tracked_bodies'] ++ + def run(self): + if self.initialise: + self.initialise = False +@@ -108,6 +122,7 @@ class PhysicsGame: + self.world = elements.Elements(self.screen.get_size()) + self.world.renderer.set_surface(self.screen) + self.world.add.ground() ++ self.check_queue() + + while self.running: + # Pump GTK messages. +diff --git a/samples/example-1.json b/samples/example-1.json +index bc2d963..d41a235 100644 +--- a/samples/example-1.json ++++ b/samples/example-1.json +@@ -1 +1 @@ +-{"bodylist": [{"userData": {"color": [143, 147, 43], "saveid": 1}, "linearVelocity": [0.0, 0.0], "dynamic": false, "angularVelocity": 0.0, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-50.0, -0.10000000149011612], [50.0, -0.10000000149011612], [50.0, 0.10000000149011612], [-50.0, 0.10000000149011612]], "friction": 0.5, "density": 0.0}], "position": [-10.0, 0.0], "angle": 0.0}, {"userData": {"color": [29, 78, 41], "saveid": 2}, "linearVelocity": [5.1063008308410645, -0.0966726690530777], "dynamic": true, "angularVelocity": 0.06375838816165924, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0299999713897705, -0.1599999964237213], [1.0299999713897705, -0.1599999964237213], [1.0299999713897705, 0.1599999964237213], [-1.0299999713897705, 0.1599999964237213]], "friction": 1.0, "density": 1.0}], "position": [9.825321197509766, 3.7749600410461426], "angle": 0.010233565233647823}, {"userData": {"color": [115, 121, 52], "saveid": 3}, "linearVelocity": [-0.06851678341627121, 0.1878681778907776], "dynamic": true, "angularVelocity": -19.998010635375977, "shapes": [{"localPosition": [0.0, 0.0], "density": 1.0, "friction": 1.0, "radius": 0.3176476061344147, "type": "circle", "restitution": 0.1599999964237213}], "position": [12.090017318725586, 3.880570411682129], "angle": -3226.47265625}, {"userData": {"color": [4, 4, 4], "saveid": 4}, "linearVelocity": [-0.012356660328805447, -0.013496986590325832], "dynamic": true, "angularVelocity": -0.026746369898319244, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0, -0.10000000149011612], [1.0, -0.10000000149011612], [1.0, 0.10000000149011612], [-1.0, 0.10000000149011612]], "friction": 1.0, "density": 1.0}], "position": [10.149999618530273, 4.039988040924072], "angle": -1.3206712537794374e-05}, {"userData": {"color": [103, 149, 206], "saveid": 5}, "linearVelocity": [-3.5460691056847074e-18, -3.155203022478189e-16], "dynamic": true, "angularVelocity": -3.5057851947864157e-16, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0, -0.10000000149011612], [1.0, -0.10000000149011612], [1.0, 0.10000000149011612], [-1.0, 0.10000000149011612]], "friction": 1.0, "density": 1.0}], "position": [10.159998893737793, 3.50988507270813], "angle": -0.0001294112007599324}, {"userData": {"color": [32, 61, 97], "saveid": 6}, "linearVelocity": [-2.930193431893713e-06, -0.0001114434126066044], "dynamic": true, "angularVelocity": -0.00025329506024718285, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.49000000953674316, -0.09000000357627869], [0.49000000953674316, -0.09000000357627869], [0.49000000953674316, 0.09000000357627869], [-0.49000000953674316, 0.09000000357627869]], "friction": 1.0, "density": 1.0}], "position": [6.389981269836426, 5.198428630828857], "angle": -0.00356997549533844}, {"userData": {"color": [114, 154, 85], "saveid": 7}, "linearVelocity": [5.184494495391846, -0.30699706077575684], "dynamic": true, "angularVelocity": 0.6322950720787048, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.09000000357627869, -0.9200000166893005], [0.09000000357627869, -0.9200000166893005], [0.09000000357627869, 0.9200000166893005], [-0.09000000357627869, 0.9200000166893005]], "friction": 1.0, "density": 1.0}], "position": [8.701557159423828, 3.692413330078125], "angle": 0.025904174894094467}, {"userData": {"color": [97, 92, 87], "saveid": 8}, "linearVelocity": [0.0, 0.0], "dynamic": true, "angularVelocity": 0.0, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.5799999833106995, -0.12999999523162842], [0.5799999833106995, -0.12999999523162842], [0.5799999833106995, 0.12999999523162842], [-0.5799999833106995, 0.12999999523162842]], "friction": 1.0, "density": 1.0}], "position": [4.349999904632568, 5.320000171661377], "angle": 1.9621124169866277e-10}, {"userData": {"color": [97, 92, 87], "saveid": 9}, "linearVelocity": [-3.691237688064575, -2.536045551300049], "dynamic": true, "angularVelocity": 6.762477397918701, "shapes": [{"localPosition": [0.0, 0.0], "density": 1.0, "friction": 1.0, "radius": 0.44045430421829224, "type": "circle", "restitution": 0.1599999964237213}], "position": [7.564259052276611, 3.4274470806121826], "angle": 189.94871520996094}], "jointlist": [{"userData": null, "anchor2": [10.782434463500977, 3.8013992309570312], "anchor1": [12.1236572265625, 4.119041442871094], "collideConnected": true, "body1": 3, "body2": 2, "type": "distance"}, {"userData": null, "collideConnected": false, "maxMotorTorque": 900.0, "motorSpeed": -20.0, "body1": 0, "body2": 3, "type": "revolute", "anchor": [12.100000381469727, 3.880000114440918], "enableMotor": true}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 6, "type": "revolute", "anchor": [5.949999809265137, 5.210000038146973], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 6, "type": "revolute", "anchor": [6.809999942779541, 5.179999828338623], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 5, "type": "revolute", "anchor": [9.260000228881836, 3.5199999809265137], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 5, "type": "revolute", "anchor": [11.079999923706055, 3.5199999809265137], "enableMotor": false}, {"userData": null, "anchor2": [8.928057670593262, 3.8186371326446533], "anchor1": [8.698497772216797, 4.582632541656494], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [8.75252628326416, 2.8834619522094727], "anchor1": [8.929726600646973, 3.668646812438965], "collideConnected": true, "body1": 2, "body2": 7, "type": "distance"}, {"userData": null, "anchor2": [8.988722801208496, 3.7593088150024414], "anchor1": [8.759982109069824, 3.7539472579956055], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [9.074294090270996, 3.773066282272339], "anchor1": [8.707780838012695, 4.18119478225708], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [9.074294090270996, 3.773066282272339], "anchor1": [9.074294090270996, 3.773066282272339], "collideConnected": true, "body1": 2, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [8.717300415039062, 3.2407641410827637], "anchor1": [9.045650482177734, 3.692570447921753], "collideConnected": true, "body1": 2, "body2": 7, "type": "distance"}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 8, "type": "revolute", "anchor": [3.869999885559082, 5.309999942779541], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 8, "type": "revolute", "anchor": [4.829999923706055, 5.309999942779541], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 4, "type": "revolute", "anchor": [9.229999542236328, 4.050000190734863], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 4, "type": "revolute", "anchor": [11.050000190734863, 4.039999961853027], "enableMotor": false}, {"userData": null, "anchor2": [6.410006523132324, 5.209431171417236], "anchor1": [7.563085556030273, 3.417515993118286], "collideConnected": true, "body1": 9, "body2": 6, "type": "distance"}], "controllerlist": [], "additional_vars": {"trackinfo": {}, "full_pos_list": [], "tracked_bodies": 0}} +\ No newline at end of file ++{"bodylist": [{"userData": {"color": [143, 147, 43], "saveid": 1}, "linearVelocity": [0.0, 0.0], "dynamic": false, "angularVelocity": 0.0, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-50.0, -0.10000000149011612], [50.0, -0.10000000149011612], [50.0, 0.10000000149011612], [-50.0, 0.10000000149011612]], "friction": 0.5, "density": 0.0}], "position": [-10.0, 0.0], "angle": 0.0}, {"userData": {"color": [29, 78, 41], "saveid": 2}, "linearVelocity": [5.1063008308410645, -0.0966726690530777], "dynamic": true, "angularVelocity": 0.06375838816165924, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0299999713897705, -0.1599999964237213], [1.0299999713897705, -0.1599999964237213], [1.0299999713897705, 0.1599999964237213], [-1.0299999713897705, 0.1599999964237213]], "friction": 1.0, "density": 1.0}], "position": [9.825321197509766, 3.7749600410461426], "angle": 0.010233565233647823}, {"userData": {"color": [115, 121, 52], "saveid": 3}, "linearVelocity": [-0.06851678341627121, 0.1878681778907776], "dynamic": true, "angularVelocity": -19.998010635375977, "shapes": [{"localPosition": [0.0, 0.0], "density": 1.0, "friction": 1.0, "radius": 0.3176476061344147, "type": "circle", "restitution": 0.1599999964237213}], "position": [12.090017318725586, 3.880570411682129], "angle": -3226.47265625}, {"userData": {"color": [4, 4, 4], "saveid": 4}, "linearVelocity": [-0.012356660328805447, -0.013496986590325832], "dynamic": true, "angularVelocity": -0.026746369898319244, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0, -0.10000000149011612], [1.0, -0.10000000149011612], [1.0, 0.10000000149011612], [-1.0, 0.10000000149011612]], "friction": 1.0, "density": 1.0}], "position": [10.149999618530273, 4.039988040924072], "angle": -1.3206712537794374e-05}, {"userData": {"color": [103, 149, 206], "saveid": 5}, "linearVelocity": [-3.5460691056847074e-18, -3.155203022478189e-16], "dynamic": true, "angularVelocity": -3.5057851947864157e-16, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-1.0, -0.10000000149011612], [1.0, -0.10000000149011612], [1.0, 0.10000000149011612], [-1.0, 0.10000000149011612]], "friction": 1.0, "density": 1.0}], "position": [10.159998893737793, 3.50988507270813], "angle": -0.0001294112007599324}, {"userData": {"color": [32, 61, 97], "saveid": 6}, "linearVelocity": [-2.930193431893713e-06, -0.0001114434126066044], "dynamic": true, "angularVelocity": -0.00025329506024718285, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.49000000953674316, -0.09000000357627869], [0.49000000953674316, -0.09000000357627869], [0.49000000953674316, 0.09000000357627869], [-0.49000000953674316, 0.09000000357627869]], "friction": 1.0, "density": 1.0}], "position": [6.389981269836426, 5.198428630828857], "angle": -0.00356997549533844}, {"userData": {"color": [114, 154, 85], "saveid": 7}, "linearVelocity": [5.184494495391846, -0.30699706077575684], "dynamic": true, "angularVelocity": 0.6322950720787048, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.09000000357627869, -0.9200000166893005], [0.09000000357627869, -0.9200000166893005], [0.09000000357627869, 0.9200000166893005], [-0.09000000357627869, 0.9200000166893005]], "friction": 1.0, "density": 1.0}], "position": [8.701557159423828, 3.692413330078125], "angle": 0.025904174894094467}, {"userData": {"color": [97, 92, 87], "saveid": 8}, "linearVelocity": [0.0, 0.0], "dynamic": true, "angularVelocity": 0.0, "shapes": [{"restitution": 0.1599999964237213, "type": "polygon", "vertices": [[-0.5799999833106995, -0.12999999523162842], [0.5799999833106995, -0.12999999523162842], [0.5799999833106995, 0.12999999523162842], [-0.5799999833106995, 0.12999999523162842]], "friction": 1.0, "density": 1.0}], "position": [4.349999904632568, 5.320000171661377], "angle": 1.9621124169866277e-10}, {"userData": {"color": [97, 92, 87], "saveid": 9}, "linearVelocity": [-3.691237688064575, -2.536045551300049], "dynamic": true, "angularVelocity": 6.762477397918701, "shapes": [{"localPosition": [0.0, 0.0], "density": 1.0, "friction": 1.0, "radius": 0.44045430421829224, "type": "circle", "restitution": 0.1599999964237213}], "position": [7.564259052276611, 3.4274470806121826], "angle": 189.94871520996094}], "jointlist": [{"userData": null, "anchor2": [10.782434463500977, 3.8013992309570312], "anchor1": [12.1236572265625, 4.119041442871094], "collideConnected": true, "body1": 3, "body2": 2, "type": "distance"}, {"userData": null, "collideConnected": false, "maxMotorTorque": 900.0, "motorSpeed": -20.0, "body1": 0, "body2": 3, "type": "revolute", "anchor": [12.100000381469727, 3.880000114440918], "enableMotor": true}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 6, "type": "revolute", "anchor": [5.949999809265137, 5.210000038146973], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 6, "type": "revolute", "anchor": [6.809999942779541, 5.179999828338623], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 5, "type": "revolute", "anchor": [9.260000228881836, 3.5199999809265137], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 5, "type": "revolute", "anchor": [11.079999923706055, 3.5199999809265137], "enableMotor": false}, {"userData": null, "anchor2": [8.928057670593262, 3.8186371326446533], "anchor1": [8.698497772216797, 4.582632541656494], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [8.75252628326416, 2.8834619522094727], "anchor1": [8.929726600646973, 3.668646812438965], "collideConnected": true, "body1": 2, "body2": 7, "type": "distance"}, {"userData": null, "anchor2": [8.988722801208496, 3.7593088150024414], "anchor1": [8.759982109069824, 3.7539472579956055], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [9.074294090270996, 3.773066282272339], "anchor1": [8.707780838012695, 4.18119478225708], "collideConnected": true, "body1": 7, "body2": 2, "type": "distance"}, {"userData": null, "anchor2": [8.717300415039062, 3.2407641410827637], "anchor1": [9.045650482177734, 3.692570447921753], "collideConnected": true, "body1": 2, "body2": 7, "type": "distance"}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 8, "type": "revolute", "anchor": [3.869999885559082, 5.309999942779541], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 8, "type": "revolute", "anchor": [4.829999923706055, 5.309999942779541], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 4, "type": "revolute", "anchor": [9.229999542236328, 4.050000190734863], "enableMotor": false}, {"userData": null, "collideConnected": false, "maxMotorTorque": 0.0, "motorSpeed": 0.0, "body1": 0, "body2": 4, "type": "revolute", "anchor": [11.050000190734863, 4.039999961853027], "enableMotor": false}, {"userData": null, "anchor2": [6.410006523132324, 5.209431171417236], "anchor1": [7.563085556030273, 3.417515993118286], "collideConnected": true, "body1": 9, "body2": 6, "type": "distance"}], "controllerlist": [], "additional_vars": {"trackinfo": {}, "full_pos_list": [], "tracked_bodies": 0}} +\ No newline at end of file diff --git a/physics-monitors.patch b/physics-monitors.patch index d0d9944..1c0a4a2 100644 --- a/physics-monitors.patch +++ b/physics-monitors.patch @@ -1,8 +1,8 @@ diff --git a/activity.py b/activity.py -index ca761d8..f5c074c 100644 +index 699378a..0d76dcf 100644 --- a/activity.py +++ b/activity.py -@@ -58,6 +58,7 @@ from collabwrapper import CollabWrapper +@@ -60,6 +60,7 @@ from collabwrapper import CollabWrapper import tools from physics import PhysicsGame @@ -10,9 +10,9 @@ index ca761d8..f5c074c 100644 from sugarapp.widgets import ExtendedActivityToolbarButton from sugarapp.widgets import SugarCompatibleActivity -@@ -89,8 +90,8 @@ class PhysicsActivity(SugarCompatibleActivity): - self._notebook = Gtk.Notebook(show_tabs=False) +@@ -92,8 +93,8 @@ class PhysicsActivity(SugarCompatibleActivity): self._notebook.add(self.game.canvas) + self._notebook.show() - w = Gdk.Screen.width() - h = Gdk.Screen.height() - 2 * GRID_CELL_SIZE @@ -21,10 +21,10 @@ index ca761d8..f5c074c 100644 self.game.canvas.set_size_request(w, h) -@@ -116,8 +117,8 @@ class PhysicsActivity(SugarCompatibleActivity): +@@ -119,8 +120,8 @@ class PhysicsActivity(SugarCompatibleActivity): ''' Screen size has changed ''' self.write_file(os.path.join( - activity.get_activity_root(), 'data', 'data')) + get_activity_root(), 'data', 'data')) - w = Gdk.Screen.width() - h = Gdk.Screen.height() - 2 * GRID_CELL_SIZE + w = PrimaryMonitor.width() @@ -32,7 +32,7 @@ index ca761d8..f5c074c 100644 pygame.display.set_mode((w, h), pygame.RESIZABLE) self.read_file(os.path.join( -@@ -645,7 +646,7 @@ class PhysicsActivity(SugarCompatibleActivity): +@@ -652,7 +653,7 @@ class PhysicsActivity(SugarCompatibleActivity): self._sample_window.set_border_width(4) self._sample_window.set_size_request( @@ -41,4 +41,3 @@ index ca761d8..f5c074c 100644 self._sample_window.show() store = Gtk.ListStore(GdkPixbuf.Pixbuf, str) - diff --git a/physics-port.patch b/physics-port.patch index e51c2a2..5081f21 100644 --- a/physics-port.patch +++ b/physics-port.patch @@ -1,16 +1,8 @@ diff --git a/activity.py b/activity.py -index 48b588c..ca761d8 100644 +index 18c3593..d3d0e72 100644 --- a/activity.py +++ b/activity.py -@@ -40,7 +40,6 @@ from gi.repository import Gtk - from gi.repository import GdkPixbuf - - from sugar3.activity import activity --from sugar3.activity.widgets import ActivityToolbarButton - from sugar3.activity.widgets import StopButton - from sugar3.graphics.objectchooser import ObjectChooser - from sugar3.graphics.radiotoolbutton import RadioToolButton -@@ -59,19 +58,21 @@ from collabwrapper import CollabWrapper +@@ -60,19 +60,21 @@ from collabwrapper import CollabWrapper import tools from physics import PhysicsGame @@ -23,27 +15,28 @@ index 48b588c..ca761d8 100644 FAST_FPS = 50 --class PhysicsActivity(activity.Activity): +-class PhysicsActivity(Activity): +class PhysicsActivity(SugarCompatibleActivity): def __init__(self, handle): - super(PhysicsActivity, self).__init__(handle) +- Activity.__init__(self, handle) ++ SugarCompatibleActivity.__init__(self, handle) self._collab = CollabWrapper(self) self._collab.message.connect(self.__message_cb) - self.metadata['mime_type'] = 'application/x-physics-activity' self.add_events(Gdk.EventMask.ALL_EVENTS_MASK | Gdk.EventMask.VISIBILITY_NOTIFY_MASK) -@@ -136,7 +137,7 @@ class PhysicsActivity(activity.Activity): - self.max_participants = 4 +@@ -141,7 +143,7 @@ class PhysicsActivity(Activity): + self.set_toolbar_box(toolbar_box) + toolbar_box.show() - toolbar_box = ToolbarBox() - activity_button = ActivityToolbarButton(self) + activity_button = ExtendedActivityToolbarButton(self) - toolbar_box.toolbar.insert(activity_button, 0) + toolbar_box.toolbar.insert(activity_button, -1) activity_button.show() -@@ -196,22 +197,6 @@ class PhysicsActivity(activity.Activity): +@@ -202,22 +204,9 @@ class PhysicsActivity(Activity): toolbar_box.toolbar.insert(stop, -1) stop.show() @@ -63,18 +56,21 @@ index 48b588c..ca761d8 100644 - activity_button.props.page.insert(load_project, -1) - load_project.show() - - self.set_toolbar_box(toolbar_box) - toolbar_box.show_all() - create_toolbar.set_expanded(True) -@@ -279,7 +264,6 @@ class PhysicsActivity(activity.Activity): - return (color.red / 256, color.green / 256, color.blue / 256) ++ self.set_toolbar_box(toolbar_box) ++ toolbar_box.show_all() ++ create_toolbar.set_expanded(True) + return toolbar_box + + def __color_notify_cb(self, button, pdesc): +@@ -282,7 +271,6 @@ class PhysicsActivity(Activity): + return (color.red // 256, color.green // 256, color.blue // 256) def can_close(self): - self.preview = self.get_preview() self.game.running = False return True -@@ -481,8 +465,6 @@ class PhysicsActivity(activity.Activity): +@@ -484,8 +472,6 @@ class PhysicsActivity(Activity): def _export_json_cb(self, button): jobject = datastore.create() @@ -83,7 +79,7 @@ index 48b588c..ca761d8 100644 tmp_dir = os.path.join(self.get_activity_root(), 'instance') fd, file_path = tempfile.mkstemp(dir=tmp_dir) -@@ -616,15 +598,6 @@ class PhysicsActivity(activity.Activity): +@@ -619,15 +605,6 @@ class PhysicsActivity(Activity): def send_event(self, text): self._collab.post(dict(action='text', text=text)) @@ -99,4 +95,3 @@ index 48b588c..ca761d8 100644 def __load_game(self, file_path, journal=False): confirmation_alert = ConfirmationAlert() confirmation_alert.props.title = _('Are You Sure?') - From 89044da2ac7793ff3577dbc8d051106efcf49823 Mon Sep 17 00:00:00 2001 From: Sparsh Goenka <43041139+sparshg@users.noreply.github.com> Date: Sun, 16 Jul 2023 16:01:40 +0530 Subject: [PATCH 7/9] Add README.md --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c70022c --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Physics Flatpak + +Physics is a physical world simulator and playground. You can add squares, circles, triangles, or draw your own shapes, and see them come to life with forces, friction, and inertia. + +To know more refer: https://github.com/sugarlabs/physics + +## How To Build + +``` +git clone https://github.com/flathub/org.sugarlabs.Physics.git +cd org.sugarlabs.Physics +flatpak -y --user install org.gnome.{Platform,Sdk}//44 +flatpak-builder --user --force-clean --install build org.sugarlabs.Physics.json +``` + +## Check For Updates + +Install the flatpak external data checker +``` +flatpak --user install org.flathub.flatpak-external-data-checker +``` + +Now to update every single module to the latest stable version use +``` +cd org.sugarlabs.Physics +flatpak run --filesystem=$PWD org.flathub.flatpak-external-data-checker org.sugarlabs.Physics.json +``` \ No newline at end of file From 5d9464957f7cc3815a8af753cc68aa096a054241 Mon Sep 17 00:00:00 2001 From: sparshg <43041139+sparshg@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:46:27 +0530 Subject: [PATCH 8/9] activity: Patch sugargame --- org.sugarlabs.Physics.json | 4 + physics-fix-sugargame.patch | 173 ++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 physics-fix-sugargame.patch diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index cc9f734..8c1b9ae 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -119,6 +119,10 @@ "type": "patch", "path": "physics-fix-save.patch" }, + { + "type": "patch", + "path": "physics-fix-sugargame.patch" + }, { "type": "patch", "path": "physics-fix-remove-joint.patch" diff --git a/physics-fix-sugargame.patch b/physics-fix-sugargame.patch new file mode 100644 index 0000000..1ded01a --- /dev/null +++ b/physics-fix-sugargame.patch @@ -0,0 +1,173 @@ +diff --git a/sugargame/event.py b/sugargame/event.py +index 3befdef..2d68154 100644 +--- a/sugargame/event.py ++++ b/sugargame/event.py +@@ -64,6 +64,143 @@ class Translator(object): + pygame.K_RSHIFT: pygame.KMOD_RSHIFT, + } + ++ keys = [ ++ pygame.K_UNKNOWN, ++ pygame.K_BACKSPACE, ++ pygame.K_TAB, ++ pygame.K_RETURN, ++ pygame.K_ESCAPE, ++ pygame.K_SPACE, ++ pygame.K_EXCLAIM, ++ pygame.K_QUOTEDBL, ++ pygame.K_HASH, ++ pygame.K_DOLLAR, ++ pygame.K_PERCENT, ++ pygame.K_AMPERSAND, ++ pygame.K_QUOTE, ++ pygame.K_LEFTPAREN, ++ pygame.K_RIGHTPAREN, ++ pygame.K_ASTERISK, ++ pygame.K_PLUS, ++ pygame.K_COMMA, ++ pygame.K_MINUS, ++ pygame.K_PERIOD, ++ pygame.K_SLASH, ++ pygame.K_0, ++ pygame.K_1, ++ pygame.K_2, ++ pygame.K_3, ++ pygame.K_4, ++ pygame.K_5, ++ pygame.K_6, ++ pygame.K_7, ++ pygame.K_8, ++ pygame.K_9, ++ pygame.K_COLON, ++ pygame.K_SEMICOLON, ++ pygame.K_LESS, ++ pygame.K_EQUALS, ++ pygame.K_GREATER, ++ pygame.K_QUESTION, ++ pygame.K_AT, ++ pygame.K_LEFTBRACKET, ++ pygame.K_BACKSLASH, ++ pygame.K_RIGHTBRACKET, ++ pygame.K_CARET, ++ pygame.K_UNDERSCORE, ++ pygame.K_BACKQUOTE, ++ pygame.K_a, ++ pygame.K_b, ++ pygame.K_c, ++ pygame.K_d, ++ pygame.K_e, ++ pygame.K_f, ++ pygame.K_g, ++ pygame.K_h, ++ pygame.K_i, ++ pygame.K_j, ++ pygame.K_k, ++ pygame.K_l, ++ pygame.K_m, ++ pygame.K_n, ++ pygame.K_o, ++ pygame.K_p, ++ pygame.K_q, ++ pygame.K_r, ++ pygame.K_s, ++ pygame.K_t, ++ pygame.K_u, ++ pygame.K_v, ++ pygame.K_w, ++ pygame.K_x, ++ pygame.K_y, ++ pygame.K_z, ++ pygame.K_DELETE, ++ pygame.K_CAPSLOCK, ++ pygame.K_F1, ++ pygame.K_F2, ++ pygame.K_F3, ++ pygame.K_F4, ++ pygame.K_F5, ++ pygame.K_F6, ++ pygame.K_F7, ++ pygame.K_F8, ++ pygame.K_F9, ++ pygame.K_F10, ++ pygame.K_F11, ++ pygame.K_F12, ++ pygame.K_PRINT, ++ pygame.K_SCROLLLOCK, ++ pygame.K_BREAK, ++ pygame.K_INSERT, ++ pygame.K_HOME, ++ pygame.K_PAGEUP, ++ pygame.K_END, ++ pygame.K_PAGEDOWN, ++ pygame.K_RIGHT, ++ pygame.K_LEFT, ++ pygame.K_DOWN, ++ pygame.K_UP, ++ pygame.K_NUMLOCK, ++ pygame.K_KP_DIVIDE, ++ pygame.K_KP_MULTIPLY, ++ pygame.K_KP_MINUS, ++ pygame.K_KP_PLUS, ++ pygame.K_KP_ENTER, ++ pygame.K_KP1, ++ pygame.K_KP2, ++ pygame.K_KP3, ++ pygame.K_KP4, ++ pygame.K_KP5, ++ pygame.K_KP6, ++ pygame.K_KP7, ++ pygame.K_KP8, ++ pygame.K_KP9, ++ pygame.K_KP0, ++ pygame.K_KP_PERIOD, ++ pygame.K_POWER, ++ pygame.K_KP_EQUALS, ++ pygame.K_F13, ++ pygame.K_F14, ++ pygame.K_F15, ++ pygame.K_HELP, ++ pygame.K_MENU, ++ pygame.K_SYSREQ, ++ pygame.K_CLEAR, ++ pygame.K_CURRENCYUNIT, ++ pygame.K_CURRENCYSUBUNIT, ++ pygame.K_LCTRL, ++ pygame.K_LSHIFT, ++ pygame.K_LALT, ++ pygame.K_LMETA, ++ pygame.K_RCTRL, ++ pygame.K_RSHIFT, ++ pygame.K_RALT, ++ pygame.K_RMETA, ++ pygame.K_MODE, ++ pygame.K_AC_BACK ++ ] ++ + def __init__(self, activity, inner_evb): + """Initialise the Translator with the windows to which to listen""" + self._activity = activity +@@ -100,7 +237,6 @@ class Translator(object): + self._inner_evb.connect('screen-changed', self._screen_changed_cb) + + # Internal data +- self.__keystate = [0] * 323 + self.__button_state = [0, 0, 0] + self.__mouse_pos = (0, 0) + self.__repeat = (None, None) +@@ -108,6 +244,7 @@ class Translator(object): + self.__held_time_left = {} + self.__held_last_time = {} + self.__tick_id = None ++ self.__keystate = dict((i, False) for i in self.keys) + + def hook_pygame(self): + pygame.key.get_pressed = self._get_pressed +@@ -201,7 +338,7 @@ class Translator(object): + return True + + def _get_pressed(self): +- return self.__keystate ++ return list(self.__keystate.values()) + + def _get_mouse_pressed(self): + return self.__button_state From 0f3f914217ff0534d9398f39a2c8b6b693459fb1 Mon Sep 17 00:00:00 2001 From: sparshg <43041139+sparshg@users.noreply.github.com> Date: Sun, 27 Aug 2023 18:19:49 +0530 Subject: [PATCH 9/9] manifest: Add patch to fix clear_all button --- org.sugarlabs.Physics.json | 4 ++++ physics-fix-destroy.patch | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 physics-fix-destroy.patch diff --git a/org.sugarlabs.Physics.json b/org.sugarlabs.Physics.json index 8c1b9ae..3f02869 100644 --- a/org.sugarlabs.Physics.json +++ b/org.sugarlabs.Physics.json @@ -111,6 +111,10 @@ "type": "patch", "path": "physics-port.patch" }, + { + "type": "patch", + "path": "physics-fix-destroy.patch" + }, { "type": "patch", "path": "physics-monitors.patch" diff --git a/physics-fix-destroy.patch b/physics-fix-destroy.patch new file mode 100644 index 0000000..95653e3 --- /dev/null +++ b/physics-fix-destroy.patch @@ -0,0 +1,14 @@ +diff --git a/tools.py b/tools.py +index 78108fe..3f3c4b3 100644 +--- a/tools.py ++++ b/tools.py +@@ -98,7 +98,8 @@ class Tool(object): + elif event.action == 'clear_all': + # Get bodies and destroy them too + for body in self.game.world.world.bodies: +- self.game.world.world.DestroyBody(body) ++ if body != self.game.world.world.groundBody: ++ self.game.world.world.DestroyBody(body) + + # Add ground, because we destroyed it before + self.game.world.add.ground()