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

Update remover.py #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update remover.py #5

wants to merge 1 commit into from

Conversation

gilkzxc
Copy link

@gilkzxc gilkzxc commented Jul 20, 2023

-- Added combability to remove text answers written in red colour. As common in some courses, instead of unmarking multiple choice answers. Usually, these tests could have C/C++/Assembly code as part of the question. Which should be ignored and not removed.

-- Added combability to remove text answers written in red colour.
As common in some courses, instead of unmarking multiple choice answers.
Usually, these tests could have C/C++/Assembly code as part of the question. Which should be ignored and not removed.
Copy link
Owner

@omer-re omer-re left a comment

Choose a reason for hiding this comment

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

Thanks Gil, see my review.
I didn't change them myself as I want this PR to be yours.

@@ -78,7 +79,7 @@ def _getColorTargetOperationType(self, color_index, operations):
def getMinimumRectangleWidth(self, fontSize, minimumNumberOfLetters = 1.5):
return fontSize * minimumNumberOfLetters

def removeWordStyle(self, ignoreByteStringObject=False):
def removeWordStyle(self, is_default, ignoreByteStringObject=False):
Copy link
Owner

Choose a reason for hiding this comment

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

add default value for backwards compatibility

Comment on lines +246 to +248
def remove_images2():
writer = PdfEnhancedFileWriter()
# output_filename = asksaveasfilename(filetypes = (('PDF File', '*.pdf'), ('All Files','*.*')))
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure what's the reason for the second remove_images?
if you split cases- give it an indicative name,
better if you are able to find a way to make some condition testing that will automatically tell which one to choose.

if you are struggling- send me an example pdf of it, we can think together.

Copy link
Author

Choose a reason for hiding this comment

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

I wanted to push quickly a fix.
Should've find a better option.
Like, changing remove_images(), that you call in the main action button to receive an argument with default value.
Then, instead of another wrapper function, using a lambda expression in line 274.
Or using the partial() function and etc, like suggested here:
https://stackoverflow.com/questions/6920302/how-to-pass-arguments-to-a-button-command-in-tkinter

The suggestion of yours, that instead of the user informing which state to be, to detect by itself.
I will think about it.
But like the original purpose of the functions, were fitted to a certain type of tests. (Multiple answers marked without explanations tests.)
Also my suggested feature is.

Copy link
Author

@gilkzxc gilkzxc Jul 25, 2023

Choose a reason for hiding this comment

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

One of the major problems are, that tests don't have a uniform types, or canonical forms.

@@ -245,7 +270,8 @@ def remove_images():
#photo= PhotoImage(file=resource_path('./button_pic.png'))

#Button(root, text="Remove answers",image=photo, command=remove_images, width=100, height=120).grid(row=1, column=2,sticky=E)
Button(root, text="Remove answers", command=remove_images, font='Helvetica 12 bold', fg="red", height=4).grid(row=1, column=2, sticky=E)
Button(root, text="Remove marking answers", command=remove_images, font='Helvetica 12 bold', fg="red", height=4).grid(row=1, column=2, sticky=E)
Button(root, text="Remove red answers without deleteing code", command=remove_images2, font='Helvetica 12 bold', fg="red", height=4).grid(row=2, column=2, sticky=E)
Copy link
Owner

Choose a reason for hiding this comment

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

see comment about #246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants