From c10fc1ba6d5154cdf2ecc0dec298befd72ceeb22 Mon Sep 17 00:00:00 2001 From: Nicole Rappe <nicole.rappe@bunny-lab.io> Date: Wed, 26 Feb 2025 01:27:08 -0700 Subject: [PATCH] Refined Identification Node --- .../identification_overlay.cpython-312.pyc | Bin 3245 -> 3995 bytes .../General Purpose/identification_overlay.py | 26 +++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Nodes/General Purpose/__pycache__/identification_overlay.cpython-312.pyc b/Nodes/General Purpose/__pycache__/identification_overlay.cpython-312.pyc index 5e05c3d988682386a9c2c567857dcdab72c70d54..8fbc8dd0ce6dceebd89d397eede6ae2c9749d523 100644 GIT binary patch delta 1311 zcmZuw+iM(E7(Zt&yJu#0*G;zB-E@=eY%c62o2EpgR)X!CDg-puMk)zNTr#uCguQuY zw#|kO*@r%)Do8na0euJ-q?q(CC`Qw~2qGq?CCj4Vn+OWAjZ%E_oW1tJ@8S1-XTIw> zzi;kze-?Co?{vz5%GW>aELN18t|I*N=Ek?dxSC1gMI#$mlUYs8=hA5-yQrqH{%%3f zE)>ZO%)v3T2g7bnybk8<8(;;_p&1ahkrQZgh$9B~1-Z-lJc{PfoZG?{&$<8rf#xDk zKA}9NxwQ_hQ}b+}BD4Gy>>{`L8?cw;_#UAMqF%Bfq~eZ7=Xut7)%$v5j#rv<sF92r zt@7h%&sM#pkMojWh4W-k{HWVs$ZJVUpMNsHKKVD|J1|64TO9sEUb9{CR*>Te1rAW) z)9L;A#qY-VQQ$s$gWR&EMvrYkavq_f12psig&(o;7a+ri*r;aLdh`{APXH;~ed}<m z5wQj(U^OlcfW}#3BMX#TF<V^y+ZtB_%c$vZ>t&^FH?0!a>;OSg7yuTVq9%g?i|h1# z`8949d=R|`R`^+P4MxS)IazJUWj(2xs<ou61yjc(nw~PU`u`AIqrLuy^>E9`=vXzf zmX5C`(`Q-*v4{5lU87)}(3`JMM{QNdqHfLSaW1c8t61eT$(1TkGpq8IWV)cgjByU* zFwLln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<(e zmk4nQiO`N9Rks{NyYCW1YrCH1Tdw1gad2bf_&9W9x8({|krIWa5<39QM@7ZGXA)cQ z6e;WNK~Xsaj`FH}gqH6oW-91YR-Q#@yQ0pV<+rPt;trB$Rendo6w4x1)#)4TrUTzV z(X<6y_q+wuwl$5ea)SA?&zUBJ=}{(SkYEp43V$A>e&+o0)qbM1JhvZ83i*S{5uu66 r6ns-#`6<@GS_84#a*ajXJV!3ml6iV%XvPc4Q@Dv=ioX%dgz5hR`gx%; diff --git a/Nodes/General Purpose/identification_overlay.py b/Nodes/General Purpose/identification_overlay.py index 1510ab6..8bccf67 100644 --- a/Nodes/General Purpose/identification_overlay.py +++ b/Nodes/General Purpose/identification_overlay.py @@ -3,7 +3,7 @@ Identification Overlay Node: - Creates an OCR region in data_collector with a blue overlay. - Detects instances of a specified word and draws adjustable overlays. -- Users can configure offset and margin dynamically. +- Users can configure offset, margin, and polling frequency dynamically. """ import re @@ -22,8 +22,9 @@ class IdentificationOverlayNode(BaseNode): # User-configurable options self.add_text_input("search_term", "Search Term", text="Aibatt") - self.add_text_input("offset_value", "Offset Value (X,Y)", text="0,0") # New input - self.add_text_input("margin", "Margin", text="5") # New input + self.add_text_input("offset_value", "Offset Value (X,Y)", text="0,0") # X,Y Offset + self.add_text_input("margin", "Margin", text="5") # Box Margin + self.add_text_input("polling_freq", "Polling Frequency (ms)", text="500") # New input self.region_id = "identification_overlay" data_collector.create_ocr_region(self.region_id, x=250, y=50, w=300, h=200, color=(0, 0, 255)) @@ -34,7 +35,21 @@ class IdentificationOverlayNode(BaseNode): # Timer for updating overlays self.timer = QTimer() self.timer.timeout.connect(self.update_overlay) - self.timer.start(500) # Update every 500ms + + # Set initial polling frequency + self.update_polling_frequency() + + def update_polling_frequency(self): + """ + Reads the user-defined polling frequency and updates the timer interval. + """ + polling_text = self.get_property("polling_freq") + try: + polling_interval = max(100, int(polling_text)) # Minimum 100ms to avoid overloading + except ValueError: + polling_interval = 500 # Default to 500ms + + self.timer.start(polling_interval) def update_overlay(self): """ @@ -44,6 +59,9 @@ class IdentificationOverlayNode(BaseNode): offset_text = self.get_property("offset_value") margin_text = self.get_property("margin") + # Read and apply polling frequency updates + self.update_polling_frequency() + # Parse user-defined offset try: offset_x, offset_y = map(int, offset_text.split(","))