Skip to content

Commit f534a7a

Browse files
Conversion folder added
1 parent 7ff85ed commit f534a7a

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.exe
1+
*.exe
2+
/Conversion

PyQtDesigner/WebScrapper/WebScrapper.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,30 @@ class Web(QtWidgets.QMainWindow):
2525
def __init__(self):
2626
super(Web,self).__init__()
2727
self.scriptDir = os.path.dirname(os.path.realpath(__file__))
28-
uic.loadUi(self.scriptDir + os.path.sep + 'WebScrapper.ui',self)
28+
filePath = self.scriptDir + os.path.sep + 'WebScrapper.ui'
29+
filePath = os.path.join(os.path.dirname(sys.executable), filePath)
30+
uic.loadUi(filePath,self)
2931
self.setWindowIcon(QIcon(self.scriptDir + os.path.sep + 'icon.png'))
3032
self.setWindowTitle('WebScrapper by [@Nishant Ghanate]')
33+
# self.setFixedSize(1366, 768)
3134
self.buttonGetInput.clicked.connect(self.getInput)
3235
self.buttonSaveLogs.clicked.connect(self.saveLogs)
3336
self.buttonClearLogs.clicked.connect(self.clearLogs)
3437
self.buttonClear.clicked.connect(self.clear)
3538
self.buttonStop.clicked.connect(self.stop)
39+
self.buttonStop.setEnabled(False)
3640
self.oldUrl = "_"
3741
self.Guide = Guide()
3842
self.actionGuide.triggered.connect(self.guideWindow)
3943

44+
def resource_path(relative_path):
45+
if hasattr(sys, '_MEIPASS'):
46+
return os.path.join(sys._MEIPASS, relative_path)
47+
return os.path.join(os.path.abspath("."), relative_path)
48+
4049
#Acttivate UI fucntions
4150
QtCore.pyqtSlot()
42-
51+
4352
# Returns Time in e.g 1 oct 2018 formart
4453
def getTimeStamp(self):
4554
return datetime.now().strftime("%A %d. %B %Y %I:%M:%S %p")
@@ -91,7 +100,7 @@ def getSource(self):
91100
except :
92101
self.listWidgetLogs.addItem('Xpath exception please try again')
93102

94-
103+
95104
# Get button function connection
96105
def getInput(self):
97106
url = self.textEditUrl.toPlainText()
@@ -106,10 +115,11 @@ def getInput(self):
106115
self.processGetSource = multiprocessing.Process(target=self.getSource())
107116
self.processGetSource.start()
108117
self.processGetSource.join()
109-
118+
self.buttonGetInput.setEnabled(False)
110119
print ('Process joined:', self.processGetSource, self.processGetSource.is_alive())
111120
print ('Process exit code:', self.processGetSource.exitcode)
112121
if self.processGetSource.exitcode == 0:
122+
self.buttonStop.setEnabled(False)
113123
self.stop()
114124
elif url is None or len(url) < 5:
115125
timestampDay = self.getTimeStamp()
@@ -126,7 +136,7 @@ def saveLogs(self):
126136
fileName = self.scriptDir + os.path.sep +'WebScrappingLogs '+ timestampDay +'.txt'
127137
file = open(fileName,'a+' , encoding='utf-8')
128138

129-
file.writelines('Command Logs ' + timestampDay)
139+
file.writelines('Command Logs ' + timestampDay + '\n')
130140
for i in range(self.listWidgetMain.count()):
131141
file.writelines(self.listWidgetMain.item(i).text() + '\n')
132142

PyQtDesigner/WebScrapper/test.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ https://old.reddit.com/r/ProgrammerHumor/
22

33
//p[@class="title"]//a[@href]//text()
44

5-
======================================
6-
pip install tornado
5+
============================================================================
76
pip install pywin32
7+
pip install pyinstaller
8+
9+
in cmd
10+
pyinstaller --onedir --onefile --name=Webscrapping --windowed "H:\Github\PythonScripts\PyQtDesigner\WebScrapper\WebScrapper.py"
11+
12+
============================================================================
13+
14+
in cmd :
15+
cd G:\Program Files\Python36\Scripts
16+
17+
G:\Program Files\Python36\Scripts>pyuic5 -x "H:\Github\PythonScripts\PyQtDesigner\WebScrapper\WebScrapper.ui" -o "H:\Github\PythonScripts\PyQtDesigner\WebScrapper\WebScrapperUI.py"
818

9-
pyinstaller --onedir --onefile --name=Webscrapping --windowed "H:\Github\PythonScripts\PyQtDesigner\WebScrapper\WebScrapper.py"

0 commit comments

Comments
 (0)