Skip to content

Gilbert is an open source application written in Python using Kivy. It was created by Alan Verdugo in order to help students learn about electricity and magnetism.

License

Notifications You must be signed in to change notification settings

alanverdugo/gilbert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gilbert

forthebadge

Gilbert is an open source application written in Python using Kivy. It was created by Alan Verdugo in order to help students learn about electricity and magnetism.

It was created with the Autonomous University of Chihuahua (UACH) in mind, but hopefully this will help students all over the world.

Named after one of the great minds of science: William Gilbert, who made great contributions to the field of electromagnetism, among others.


Usage

The application consist in different "sections". The main menu presents the available options. You can read the usage instructions for each section by using the "?" button in each screen, or by reading the following paragraphs.

Study section

The study section is designed to provide a user-friendly way to study text lectures. Simply select the lecture in the upper-left menu and read on the right side panel.

Quiz section

A student trying to test his or her knowledge will find this section useful. Random questions are presented in a quiz. The user selects the correct answers by pressing the appropiate button (which are also ordered randomly).

Counters indicating correct and incorrect questions are shown on the right side of the screen. Pressing the reset button on the lower right corner resets these counters.

Ohm law simulator section

This section provides a simulation of how the Ohm law is calculated. In the top of the screen, there is a triangle with the letters I (amperage), R (Resistance) and V (Voltage). Press any of them to calculate that value.

Once a value is selected the sliders for the two remaining values will become active. For example, if you choose to calculate V (Voltage), the sliders for I (Amperage) and R (Resistance) will activate.

Move the two sliders and see how the third value changes accordingly.


Motivation

Gilbert was designed and built as completely free (libre) and open source software. I decided to do this for several reasons:

  • I wanted the students to learn not just by using the application, but also by reading the code and understanding how it works.
  • The users should be at ease knowing that they will never have to pay to use the application.
  • The users should be at ease knowing that the application is not spying on them or using their data in malicious ways. They can be sure of this by inspecting the source code.
  • If they want new features, the users can directly contribute to the proyect and help improve it for other people.

Database

The application uses a SQLite database to store questions and answers in a very simple set of tables. Refer to the questions.db file in the db directory.

You can inspect the structure of the tables with the sqlite command line interface and the .schema command:

sqlite3 questions.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
sqlite> .schema questions
CREATE TABLE questions (
    question_id     INTEGER PRIMARY KEY,
    question_text   TEXT NOT NULL
);

sqlite> .schema answers
CREATE TABLE answers (
    id            INTEGER PRIMARY KEY,
    answer_text   TEXT    NOT NULL,
    is_correct    INTEGER NOT NULL, -- SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).
    question_id  INTEGER NOT NULL,
    FOREIGN KEY (question_id)
    REFERENCES questions (question_id)
       ON UPDATE CASCADE
       ON DELETE CASCADE
);

Build

Since the application uses the Kivy framework, in order to build a valid APK file that could be installed in Android devices, a build process needs to happen.

The chosen tool for this is Buildozer. Read here for the Buildozer setup instructions: https://kivy.org/doc/stable/guide/packaging-android.html#buildozer

Build a debug version of the application

First, connect your mobile device to the computer which will execute the build process.

buildozer android debug deploy run logcat > log.txt

If the build is successful, the application should be installed and start running in the connected Android device. Debug information should be written to the log.txt file in the current directory of the builder computer. This is extremelly useful to test the application on a real device.

Build a release version of the application

First export the environment variables that Google expects in order to build the .apk file(s):

export P4A_RELEASE_KEYSTORE=/path/toplaystore.keystore
export P4A_RELEASE_KEYSTORE_PASSWD=<keystore_password>
export P4A_RELEASE_KEYALIAS_PASSWD=<keyalias_password>
export P4A_RELEASE_KEYALIAS=<alias_for_the_file>

At this moment it is recommended to update the version value in buildozer.spec

Then, execute the release build:

buildozer android release

In order to target different architectures, edit the buildozer.spec file and look for the android.arch option.

#(str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = armeabi-v7a
#android.arch = arm64-v8a

Note: Currently, Google asks to target 32 and 64 bit architectures, so we need to provide one .apk file for each of them. In order to do this, the buildozer.spec file needs to be edited and use armeabi-v7a for 32 bits, execute buildozer android release, then edit the file again. Use arm64-v8a for 64 bits, execute buildozer android release again.

This will produce two .apk files, which will need to be uploaded to Google.

Note 2: If the release fails with an error like this:

Please install the mpmath package with a version >= 0.19 It is because the sympy package has the requirement. The way to solve that is explained in StackOverflow: https://stackoverflow.com/a/64597102

Basically, follow these steps:

1 - You should install mpmath on your python interpreter

2 - Copy the mpmath folder

3 - Find the sympy folder on you project project_folder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/sympy/armeabi-v7a__ndk_target_21/sympy some folders should be named different

4 - Paste the mpmath folder into folder from 3 step


How to contribute

Contributions to the project can be done in many ways. For example:

  • Testing: Download and install the application in your device. Report any problems.
  • Improve the code: Get an issue from the list and send a pull request with your changes.
  • Spread the word: Tell other people about Gilbert.
  • Donate: Help the open source proyects that helped Gilbert to become a reality. For example, you could donate to the Python Software Foundation, the Kivy project, the Linux foundation or the Free Software Foundation.

License

Copyright 2020 Alan Verdugo Muñoz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Gilbert is an open source application written in Python using Kivy. It was created by Alan Verdugo in order to help students learn about electricity and magnetism.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages