Skip to content

Commit

Permalink
Better Perfomance
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyLuna17 committed Jan 14, 2024
1 parent 20e6144 commit 37db68b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion configs/RandomSiteScrapper.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Search random sites (Testing RND function)
BLOCK=REQUEST-1|URL=https://RND(LENGTH>5, CHARS>abcdefghijklmnopqrstuvwxyz).com/|TYPE=GET
BLOCK=RESULT|VALUE=200|VAR=<REQUEST-1.status_code>|CATEGORY=HIT|RETURN=URL -> <REQUEST-1.url>
BLOCK=RESULT|VALUE=4|VAR=<REQUEST-1.status_code>|CATEGORY=DEAD
BLOCK=RESULT|VALUE=4|VAR=<REQUEST-1.status_code>|CATEGORY=DEAD
13 changes: 9 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,22 @@ def add_text_to_labels(self, content_box, labels, new_text):

# Only keep the last 100 lines
remaining_lines = 100 - len(current_label.text.split('\n'))
current_label.text = '\n'.join(lines[:remaining_lines])
lines = lines[remaining_lines:]
current_label.text = '\n'.join(lines[-remaining_lines:])
lines = lines[:-remaining_lines]

# Delete old labels when exceding 100 lines limit
while len(labels) * 100 - len(lines) > 100:
content_box.remove_widget(labels[0])
labels.pop(0)

# Add the remaining lines to new labels
while lines:
new_label = Label(text="", font_size=dp(15), size_hint_y=None, size_hint_x=None, halign="left", valign="top", color=color)
new_label.bind(texture_size=new_label.setter('size'))
new_label.text = '\n'.join(lines[:100])
new_label.text = '\n'.join(lines[:200])
content_box.add_widget(new_label)
labels.append(new_label)
lines = lines[100:]
lines = lines[200:]

def modify_line(self, labels, line_number, new_content):
"""
Expand Down

0 comments on commit 37db68b

Please sign in to comment.