-
Notifications
You must be signed in to change notification settings - Fork 72
Developer information
Minigalaxy has been created using the following tools:
Setting up a development environment can simply be done by first installing the following software:
- python3
- python3-gi
- webkit2gtk
- glade
- git
After having done so, the git repo can be cloned and the application started with:
git clone https://github.com/sharkwouter/minigalaxy.git
cd minigalaxy
bin/minigalaxy
It is also possible to use a VENV with the following set of commands:
git clone https://github.com/sharkwouter/minigalaxy.git
cd minigalaxy
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
bin/minigalaxy
- bin: contains the minigalaxy launch script
-
data: contains the ui files and other non-python files like translations, images and configuration files
- mo: contains compiled translation
- po: contains translation files
- ui: contains the Glade files which contain the interface of Minigalaxy
- debian: contains the rDebian/Ubuntu packaging specific files. Here is some good documentation on what each file does.
-
minigalaxy: contains the source code, the python files in this directory contain code which doesn't draw GTK items like windows and buttons
- window: contains the source code for all GTK items like windows and buttons
- scripts: contains some scripts for managing translations and creating screenshots for the README
Glade is used to create GTK interfaces for Minigalaxy whenever possible. The Glade files all have the following in common:
- The top level GTK item, usually the window, has the composite option enabled. This makes us able to use them as the base for a class.
- The top level GTK item is named with CamelCase.
- All text is in English.
- All strings set within Glade are translatable.
- Signals for buttons and other widgets are added from within Glade.
Glade files are loaded as the base for a class with the following line before the class definition:
@Gtk.Template.from_file(os.path.join(UI_DIR, "file.ui"))
Within the class the __gtype_name__
has to match the name of the top level GTK item. Other items are imported using widget_name_in_glade = Gtk.Template.Child()
.
Minigalaxy supports translations to multiple different languages. The default language is English. To allow for translations to work, strings will need to be set in a particular way depending on where they are located.
Strings in Glade are translatable by default. Please do set a comment for translators to give them a little bit of context as to where the string is used and what it is used for.
In python for a string to be translatable, first makes sure the following import can be found in the file you're working in:
from minigalaxy.translation import _
Then you can simply make your strings translatable by defining them by changing your string definition from the following format "your string"
to _("your string")
.
After you've defined translatable strings, you'll still need to add them to the translation file. This can simply be done by running the scripts/update-translation-files.sh
script.
Generally the Minigalaxy code is pretty clean, but there are some problem areas which will likely require fixing in the future:
minigalaxy/window/windows.py
should not contain the code for sorting the library and creating gametiles.-
minigalaxy/windows/gametile.py
should not contain the code for downloading and launching games. -
No queue was needed, it may still need to be converted to a singleton classminigalaxy/config.py
has a set function which isn't thread-safe. This class should probably be a singleton. It must at least have a queue in the future. Multiple files contain constants. These should be stored in aconstants.py
file.-
The authenticate function in(probably not needed, the __request function handles this)minigalaxy/api.py
should be a creator which is called before every other api function. Calling it directly should very rarely be required. The directoryminigalaxy/window
should be renamed, probably to something like gtk.- Usage info in
bin/minigalaxy
is not translatable. - There are currently no unit tests. Not for any of the code.
There should be a lint test for merge requests and commits to master configured on github.