Skip to content

Commit

Permalink
Added a better coding with PyQT5
Browse files Browse the repository at this point in the history
  • Loading branch information
Parathantl committed May 8, 2020
1 parent f3243c6 commit 1c96282
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 50 deletions.
40 changes: 0 additions & 40 deletions PySimpleGui/ReadMe.md

This file was deleted.

Binary file removed PySimpleGui/screenshots/Fifth.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/First.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/Fourth.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/Second.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/Seventh.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/Sixth.PNG
Binary file not shown.
Binary file removed PySimpleGui/screenshots/Third.PNG
Binary file not shown.
10 changes: 5 additions & 5 deletions PySimpleGui/SetupCreator.nsi → Setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Name "UninstallExample1"

; The file to write
OutFile "Tesseract_GUI.exe"
OutFile "Tesseract_GUI_Tool.exe"

; The default installation directory
InstallDir $PROGRAMFILES\TesseractGUI\
InstallDir $PROGRAMFILES\Tesseract_GUI\

; The text to prompt the user to enter a directory
DirText "This will install My Cool Program on your computer. Choose a directory"
Expand Down Expand Up @@ -53,7 +53,7 @@ Section ""
SetOutPath $INSTDIR

; Put a file there
File Tesseract_PySimpleGUI.exe
File Tesseract_GUI_Tool.exe

; Tell the compiler to write an uninstaller and to look for a "Uninstall" section
WriteUninstaller $INSTDIR\Uninstall.exe
Expand All @@ -62,7 +62,7 @@ SectionEnd

Section "Desktop Shortcut" SectionX
SetShellVarContext current
CreateShortCut "$DESKTOP\Tesseract_PySimpleGUI.lnk" "$INSTDIR\Tesseract_PySimpleGUI.exe"
CreateShortCut "$DESKTOP\Tesseract_GUI_Tool.lnk" "$INSTDIR\Tesseract_GUI_Tool.exe"
SectionEnd

;-------------------
Expand All @@ -71,7 +71,7 @@ SectionEnd
Section "Uninstall"

Delete $INSTDIR\Uninstall_Tesseract_GUIl.exe
Delete $INSTDIR\Tesseract_GUI.exe
Delete $INSTDIR\Tesseract_GUI_Tool.exe
RMDir $INSTDIR

SectionEnd
15 changes: 10 additions & 5 deletions PyQT5/Tesseract_GUI_Tool.py → Tesseract_GUI_Tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Author: Parathan Thiyagalingam
Website: medium.com/@parathantl
Last edited: April 2020
Last edited: May 2020
"""

import sys
Expand All @@ -33,7 +33,7 @@ def __init__(self):
self.setGeometry(self.left, self.top, self.width, self.height)

self.name = QtWidgets.QLabel(self)
self.name.setText('Created by: Thiyagalingam Parathan')
self.name.setText('Created by: Parathan Thiyagalingam')
self.name.setGeometry(QtCore.QRect(20, 40, 500, 30))

self.email = QtWidgets.QLabel(self)
Expand Down Expand Up @@ -160,14 +160,15 @@ def convertpdfToJpg(self):

for root, dirs, file in os.walk(self.single_pdf):

if (platform.system() == 'Linux'):
if (platform.system() == 'Linux' or platform.system() == 'Darwin'):
for i, files in enumerate(file):

name_file = os.path.splitext(files)[0]

cmd = r'gs -q -DNOPAUSE -DBATCH -r300x300 -SDEVICE=jpeg -dSAFER -sOutputFile='+self.jpg_folder+'/'+name_file+'.jpg '+ '"'+root+'/'+files+'"'

p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
p.communicate()

#line to change progress
QtWidgets.QApplication.processEvents()
Expand All @@ -185,6 +186,8 @@ def convertpdfToJpg(self):

p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)

p.communicate()

QtWidgets.QApplication.processEvents()

#line to change progress
Expand All @@ -201,12 +204,14 @@ def convertJpgToText(self):
cmd1 = 'tesseract '+self.jpg_folder+'/'+name_file+'.jpg '+self.text_folder+'/'+name_file+' -l '+ self.textboxValue

q = subprocess.Popen(cmd1 , shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)


q.communicate()

QtWidgets.QApplication.processEvents()

#line to change progress
self.labelA.setText('Converting JPG to Text: Page '+str(i+1)+' of '+str(len(file)))
time.sleep(2)
time.sleep(1)

if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
Expand Down
File renamed without changes.

0 comments on commit 1c96282

Please sign in to comment.