Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up to make building MacOS Package work... #77

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions build_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ file that can be run to install the software.
```sh
pyinstaller -p src --add-data="src;." -y -w --icon=src/assets/icon.ico --name=open-mcr src/main_gui.py; makensis installer.nsi
```

## MacOS
Use the following command:
``` sh
pyinstaller -p src --clean --onefile -y -w --icon=src/assets/icon.ico --name=open-mcr src/main_gui.py --add-data="src/assets/*.pdf:./assets"
```
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PyInstaller==3.5
typing==3.7.4.1
PyInstaller>=4.6
Pillow==9.2.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the change to PyInstaller>=4.6, but I'm confused by the change from typing (the type-checking tool) to Pillow (an image processing library). Was that an intentional change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pillow is the python library to use the PIL image library package. I ended up with it for something, maybe PyInstaller. I will look back at it. typing is not required for python 3.9+ as it is included. As the current python is 3.10, I am trying to update this to work with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will get to the rest of these this weekend.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typing is not required for python 3.9+ as it is included

Oh I didn't know that. 👍 to removing the dependency then, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still have to figure out why I had to add Pillow. I think it is for icon building for MacOS.

  • Revert the scrolling frame changes

  • Revert the change from using / to join paths (if you do find this causes any issues, please open an issue and I can take another look at it)

  • Remove the test_ files -- I definitely agree with having more tests but we can open issues instead of adding TODO comments, that way all the work is tracked in one place

  • Revert the requirements change from typing==3.7.4.1 to Pillow==9.2.0; this looks like a mistake (please correct me if I'm wrong!)

numpy==1.22.0
opencv-python==4.5.4.60
flake8==3.7.8
Expand Down
48 changes: 48 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import setuptools

with open("readme.md", "r") as f:
long_description = f.read()

setuptools.setup(
name="open-mcr",
url = "https://github.com/iansan5653/open-mcr",
version="1.3.0dev",
description="Graphical tool for optical mark recognition for test scoring.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Ian Sanders",
author_email="iansan5653@gmail.com",
keywords="omr, optical-mark-recognition, open-educational-resources, " \
"exam-sheets, exam-scoring",
license="GPL-3.0+",
packages=setuptools.find_packages(exclude=("dist","build",)),
data_files=[
('src/assets',['src/assets/icon.ico','src/assets/icon.svg',
'src/assets/multiple_choice_sheet_75q.pdf',
'src/assets/multiple_choice_sheet_75q.svg',
'src/assets/multiple_choice_sheet_150q.pdf',
'src/assets/multiple_choice_sheet_150q.svg',
'src/assets/social.png', 'src/assets/wordmark.png',
'src/assets/wordmark.svg', 'src/assets/manual.md',
'src/assets/manual.pdf'])
],
include_package_data=True,
install_requires=[
'PyInstaller>=4.6',
'Pillow==9.2.0',
'numpy==1.22.0',
'opencv-python==4.5.4.60',
'flake8==3.7.8',
'yapf==0.28.0',
'pytest==6.2.5',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent'
]
)
Binary file modified src/assets/multiple_choice_sheet_150q.pdf
Binary file not shown.
15 changes: 12 additions & 3 deletions src/user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,19 +610,28 @@ def __confirm(self):

def __show_help(self):
helpfile = str(Path(__file__).parent / "assets" / "manual.pdf")
subprocess.Popen([helpfile], shell=True)
if platform.system() in ('Darwin', 'Linux'):
subprocess.Popen(['open', helpfile])
else:
subprocess.Popen([helpfile], shell=True)

def __show_sheet(self):
if (self.form_variant == FormVariantSelection.VARIANT_75_Q):
helpfile = str(
Path(__file__).parent / "assets" /
"multiple_choice_sheet_75q.pdf")
subprocess.Popen([helpfile], shell=True)
if platform.system() in ('Darwin','Linux'):
subprocess.Popen(['open', helpfile])
else:
subprocess.Popen([helpfile], shell=True)
elif (self.form_variant == FormVariantSelection.VARIANT_150_Q):
helpfile = str(
Path(__file__).parent / "assets" /
"multiple_choice_sheet_150q.pdf")
subprocess.Popen([helpfile], shell=True)
if platform.system() in ('Darwin', 'Linux'):
subprocess.Popen(['open', helpfile])
else:
subprocess.Popen([helpfile], shell=True)

def __on_close(self):
self.__app.destroy()
Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/150q-core/output/results.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Last Name,First Name,Middle Name,Test Form Code,Student ID,Course ID,Source File,Q1,Q2,Q3,Q4,Q5
,,,,12345678,,a.jpg,A,B,B,D,E
,,,,12334235,,b.jpg,A,,C,D,E
,,,,12345678,,a.jpg,A,B,B,D,E
2 changes: 1 addition & 1 deletion test/end-to-end/150q-core/output/scores.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Last Name,First Name,Middle Name,Test Form Code,Student ID,Course ID,Source File,Total Score (%),Total Points,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16,Q17,Q18,Q19,Q20,Q21,Q22,Q23,Q24,Q25,Q26,Q27,Q28,Q29,Q30,Q31,Q32,Q33,Q34,Q35,Q36,Q37,Q38,Q39,Q40,Q41,Q42,Q43,Q44,Q45,Q46,Q47,Q48,Q49,Q50,Q51,Q52,Q53,Q54,Q55,Q56,Q57,Q58,Q59,Q60,Q61,Q62,Q63,Q64,Q65,Q66,Q67,Q68,Q69,Q70,Q71,Q72,Q73,Q74,Q75,Q76,Q77,Q78,Q79,Q80,Q81,Q82,Q83,Q84,Q85,Q86,Q87,Q88,Q89,Q90,Q91,Q92,Q93,Q94,Q95,Q96,Q97,Q98,Q99,Q100,Q101,Q102,Q103,Q104,Q105,Q106,Q107,Q108,Q109,Q110,Q111,Q112,Q113,Q114,Q115,Q116,Q117,Q118,Q119,Q120,Q121,Q122,Q123,Q124,Q125,Q126,Q127,Q128,Q129,Q130,Q131,Q132,Q133,Q134,Q135,Q136,Q137,Q138,Q139,Q140,Q141,Q142,Q143,Q144,Q145,Q146,Q147,Q148,Q149,Q150
,,,,12345678,,a.jpg,80.0,4,1,1,0,1,1
,,,,12334235,,b.jpg,80.0,4,1,0,1,1,1
,,,,12345678,,a.jpg,80.0,4,1,1,0,1,1
2 changes: 1 addition & 1 deletion test/end-to-end/rotation/output/results.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Last Name,First Name,Middle Name,Test Form Code,Student ID,Course ID,Source File,Q1,Q2,Q3,Q4,Q5
,,,,12334235,,90deg.jpg,A,,C,D,E
,,,,12334235,,180deg.jpg,A,,C,D,E
,,,,12334235,,270deg.jpg,A,,C,D,E
,,,,12334235,,90deg.jpg,A,,C,D,E