Skip to content

Commit ffd79e2

Browse files
Guide ui added
1 parent 9da98e8 commit ffd79e2

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

PyQtDesigner/WebScrapper/WebScapper.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,38 +68,48 @@ def getSource(self):
6868
self.getSource()
6969
except ValueError:
7070
raise InvalidSelector()
71-
exit()
71+
7272

7373
# Get button function connection
7474
def getInput(self):
7575
url = self.textEditUrl.toPlainText()
7676
self.xpathSrc = self.textEditSource.toPlainText()
77-
78-
if url and self.xpathSrc is not None:
77+
print(self.xpathSrc)
78+
if url and self.xpathSrc.strip() :
7979
source = self.validateUrl(url)
8080
if source:
81+
timestampDay = self.getTimeStamp()
82+
self.listWidgetLogs.addItem(timestampDay)
8183
self.listWidgetMain.addItem(self.xpathSrc)
8284
self.getSource()
8385
elif url is None or len(url) < 5:
8486
timestampDay = self.getTimeStamp()
8587
self.listWidgetLogs.addItem(timestampDay)
86-
self.listWidgetLogs.addItem('Url cannot be empty ¯\_(ツ)_/¯ \n')
87-
elif self.xpathSrc is None:
88-
self.listWidgetLogs.addItem('xpath input \_(ʘ_ʘ)_/ ? ')
88+
self.listWidgetLogs.addItem('Url cannot be empty ¯\_(ツ)_/¯ ')
89+
else :
90+
timestampDay = self.getTimeStamp()
91+
self.listWidgetLogs.addItem(timestampDay)
92+
self.listWidgetLogs.addItem('xpath input \_(ʘ_ʘ)_/ where is it ?')
8993

9094
# Saves logs from Preserved logs
9195
def saveLogs(self):
92-
timestampDay = datetime.now().strftime("%A, %d. %B %Y %I:%M:%S %p")
93-
file = open(self.scriptDir + os.path.sep +'WebScrappingLogs_'+timestampDay+'.txt','a+')
96+
timestampDay = datetime.now().strftime("%A %d %B %Y %I %M %S%p")
97+
file = open(self.scriptDir + os.path.sep +'WebScrappingLogs '+ timestampDay +'.txt','a+')
9498
i = 0
95-
for log in self.listWidgetLogs.item(i).text():
96-
file.write(log +'\n')
97-
i += 1
99+
logsList = []
100+
itemsTextList = [str(self.listWidgetLogs.item(i).text()) for i in range(self.listWidgetLogs.count())]
101+
102+
# for log in self.listWidgetLogs.item(i).text():
103+
# i = i+ 1
104+
# print(log)
105+
# file.writelines(log)
106+
file.writelines(itemsTextList)
98107
file.close()
99108
self.listWidgetLogs.addItem('Logs saved Sucessfully')
100109

101110
def stop(self):
102111
self.stop = True
112+
# os.system("pause")
103113

104114
# clear preservedLogs
105115
def clearLogs(self):

PyQtDesigner/WebScrapper/WebScrapper.ui

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/*background-color:rgb(195,223,255);*/
2323
background-image: url('H:/Github/PythonScripts/PyQtDesigner/WebScrapper/bg.png');
2424
background-position: center; /* Center the image */
25-
background-repeat: no-repeat;
25+
background-repeat: no-repeat;
2626
background-size: cover;
2727

2828

@@ -31,12 +31,6 @@
3131

3232
QWidget#centralwidget
3333
{
34-
/*
35-
background-image: url('H:/Github/PythonScripts/PyQtDesigner/WebScrapper/bg.png');
36-
background-size: 300px 100px;
37-
background-position: center;
38-
background-size: cover;
39-
*/
4034

4135
}
4236

0 commit comments

Comments
 (0)