Ver Fonte

added show_unread thunderbird

marton levente há 10 meses atrás
pai
commit
5a610438a0

+ 20 - 0
hotboards/auto_buttons.py

@@ -382,6 +382,26 @@ def operate_cash(confirm=False):
                 gui.press('enter')
             mv_mouse_cent()
 
+def show_unread(confirm=False):
+    ciel_win = 'Mozilla Thunderbird'
+    # active_win = gw.getActiveWindowTitle()
+    # ciel_win = gw.getWindowsWithTitle(CIEL, condition=gw.Re.CONTAINS)[0]
+    active_win = gw.getActiveWindowTitle()
+    if ciel_win in active_win:
+        # ciel_win.activate()
+        butt_x_y = gui.locateCenterOnScreen(f'ciel_imgs/{_CIEL}unread.png', confidence=CONF)
+        sleep(0.1)
+        if butt_x_y:
+            gui.click(butt_x_y[0], butt_x_y[1])
+            if confirm:
+                while gui.locateCenterOnScreen(f'ciel_imgs/{_CIEL}confirm_2.png', confidence=CONF) is None:
+                    gui.locateCenterOnScreen(f'ciel_imgs/{_CIEL}confirm_2.png', confidence=CONF)
+                    if gui.locateCenterOnScreen(f'ciel_imgs/{_CIEL}confirm_2.png', confidence=CONF):
+                        break
+                sleep(0.25)
+                gui.press('enter')
+            mv_mouse_cent()
+
 def main():
     kb.register_hotkey('control+e', callback=devalidate_doc, args=())
     kb.register_hotkey('control+w', callback=validate_doc, args=())

+ 2 - 1
hotboards/button_keys.py

@@ -24,7 +24,8 @@ keys = (
     ('control+`', auto_buttons.open_decl, []),
     ('shift+`', auto_buttons.send_decl, []),
     # ('control+i', auto_buttons.additional_inf, []),
-    ('control+i', auto_buttons.operate_cash, [])
+    ('control+i', auto_buttons.operate_cash, []),
+    ('alt+u', auto_buttons.show_unread, [])
 )
 
 def main():

BIN
hotboards/ciel_imgs/ciel_unread.png


+ 2 - 1
tests/test_hotboards.py

@@ -1,6 +1,7 @@
 '''Created 14 Sept 2023 Levi'''
 
 import unittest
+import pprint
 from time import sleep
 
 import pywinctl as gw
@@ -10,7 +11,7 @@ from pywinctl import Window as win_
 class Test(unittest.TestCase):
 
     def test_allwindows(self):
-        print(gw.getAllTitles())
+        pprint.pprint(gw.getAllTitles())
 
     def test_window(self):
         while True: