Technical - accessibilitysoftwarehub/FaceSwitch2 GitHub Wiki
This page is dedicated to the technical dcoumentation portion of our assessment.
1. Git
First, you will need to get git bash. You can get git bash here.
While Git Bash is open, input this command:
git clone https://github.com/accessibilitysoftwarehub/FaceSwitch2.git
Change directory to the FaceSwitch2 repository by using this command:
cd FaceSwitch2
You are now in the master branch!
2. Anaconda
Now you need to download Anaconda here is a user-friendly guide
You will need this program to run our python file. (We are using python version 3.6.7, because the version 3.6.8 doesn't work with our dependencies) We are going to set up a virtual environment which will be used to import libraries and install libraries. This is aimed for ease of use, so you don't need to manually install each package separately simply because they will be supplied for you.
Running the software
To use the virtual environment you'll need to open an Anaconda Prompt then input this command:
cd C:\Users\user\FaceSwitch2
pipenv shell
pipenv sync
Now that everything is set to go, you will want to run the program with this command:
python main.py
Message for developers This code runs everything above with one line.
pipenv run python main.py
3. What does each file do?:
main.py
This file contains the bulk of the code that is needed to run the program.
textboxHandler.py
This file is called by main.py when the user clicks a textbox.
keybinder.py
This file is called when main.py asks for the getUserInput function.
Pipfile
This file is generated by the pipenv shell command, and contains all the libraries needed to run the program. To install the libraries use pipenv sync command. To add a module to the Pipfile you'll need to type this command:
pipenv install [modulename]
then generate a pip lock file by deleting the original lock file, then typing
pipenv lock
Pipfile.lock
This file is generated with the pipenv lock command, and converts the pipfile in to readable machine code I guess you could say.
.gitignore
This file is used to ignore pushing certain files when pushing the local repository to the remote repository.
4. Creating the .exe
For this you will need to install pyinstaller with the command:
pip install pyinstaller
Now with pyinstaller installed you are now ready to turn the main.py in to an .exe as well as ship the dependencies.
pipenv shell
pipenv sync
pyinstaller main.py
When you've used this command, it should perform some scripts and will create a dist folder. Go to dist > main > and then you should be able to double click the main.exe in that directory.
5. Converting the .exe icon!
Download resource hacker: http://www.angusj.com/resourcehacker/
Scroll to the bottom and click the .EXE install.
Once downloaded, open it and click Install.
Uncheck View ReadMe.txt and click Finish
Go to the start menu, start typing Resource Hacker then open it up once the search results complete.
Once open, click File -> Open -> Then search for the .exe file you made in step 4
You will now need to right click the Icon folder, and click replace icon.
Click Open file with new icon...
And then navigate to the location of the new icon, and click Open.
Now you need to click Replace.
Click File -> Save.
Congratulations, you're .exe should have a new icon!
6. Creating an installer with inno setup..
Download innosetup-6.0.2.exe here Install it and open Inno Setup Compiler.
Create a new script file using the Script Wizard then Click Ok >
Click Next >
Enter the information then click Next >
Leave everything default then click Next >
Browse for the .exe you created in step 4.
Click Add folder and click the dist / main folder that pyinstaller created.
Click Yes to "Should files in subfolders of "" be included?"
Click Next >
Leave everything as default, then click Next >
Again, leave everything as default, then click Next >
Select your languages, then click Next >
Browse for desktop
Compiler output base file name, is the name of the installer. Type in anything, most preferably something around "FaceSwitchInstaller"
Change the custom installer icon like so :
Click Next >
leave everything as default, then click Next >
Click Finish
Click No to "Would you like to compile the new script now?"
It's time to add the Icons.
Add this line at the top with all the other definitions.
#define MyAppIcoName "face_switch_2_icon_black.ico"
add this line under [Files], except change the source address to the icon you are using.
Source: "C:\Users\user\Desktop\FR\FaceSwitch2\dist\main\resources\face_switch_2_icon_black.ico"; DestDir: "{app}"
add this line under [Icons]
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\resources\{#MyAppIcoName}"; Tasks: desktopicon
Now it's time to add the deletion of previous software.
add this under the [Files] tab, as a new section.
[InstallDelete]
Type: filesandordirs; Name: "C:\Users\{username}\.FaceSwitch2"
now you can press the green play button to run the script or press F9!
Wait until it finishes, and then you should have a new installer on your desktop!