test_draft.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # from datetime import datetime as dtime
  2. # from time import sleep
  3. # from win32api import GetKeyState
  4. # from win32con import VK_CAPITAL
  5. # import keyb13 as keys_
  6. from time import sleep
  7. import pyautogui as gui
  8. '''bilant quick hotkey'''
  9. pause_ = 0.05
  10. interval_ = 0.05
  11. #-------------------------------------------------------------------------------
  12. # win_ = gui.getWindow('Situatii financiare', exact=True)
  13. # win_.set_foreground()
  14. # gui.hotkey('altright', 'm', pause=pause_)
  15. # gui.press('tab', 39, interval=interval_, pause=pause_)
  16. # gui.typewrite('ELKAN', pause=pause_)
  17. # gui.press('tab', presses=1, pause=pause_)
  18. # gui.typewrite('CLAUDIA', pause=pause_)
  19. # gui.press('tab', presses=1, pause=pause_)
  20. # gui.hotkey('altright', 'down', pause=pause_)
  21. # gui.press('down', presses=4, interval=interval_, pause=pause_)
  22. # gui.press('enter', pause=pause_)
  23. # gui.press('tab', presses=1, pause=pause_)
  24. # gui.typewrite('18010', pause=pause_)
  25. #-------------------------------------------------------------------------------
  26. #-------------------------------------------------------------------------------
  27. '''capslock state display with keyboard and pywin32'''
  28. # print(GetKeyState(VK_CAPITAL))
  29. # print(keys_.key_to_scan_codes('capslock'))
  30. #===============================================================================
  31. # while True:
  32. # if keys_.is_pressed(58):
  33. # if GetKeyState(VK_CAPITAL) == 1: gui.alert('{0}'.format('capslock off'), 'capslock_state', button='ok', timeout=550)
  34. # else: gui.alert('{0}'.format('capslock on').upper(), 'capslock_state', button='ok', timeout=550)
  35. # keys_.wait(58)
  36. #===============================================================================
  37. '''send notif if nothing hapends in 5 seconds'''
  38. #===============================================================================
  39. # t = 1
  40. # while True:
  41. # if t == 1:
  42. # print('mailing')
  43. # ts = dtime.now()
  44. # sleep(1)
  45. # t += 1
  46. # if t == 10:
  47. # break
  48. #
  49. # tn = dtime.now()
  50. # print(tn - ts)
  51. # sleep_time = (tn - ts).total_seconds() > 5
  52. # if sleep_time:
  53. # print('...zzz...')
  54. # else:
  55. # print('mailing')
  56. #===============================================================================
  57. # p = True
  58. # print(p==1)
  59. # def downTime():
  60. # t = 0
  61. # while True:
  62. # if kb.is_pressed('shift'):
  63. # t+=1
  64. # time.sleep(1)
  65. # if t>2:
  66. # t=1
  67. # print(t)
  68. #
  69. # # while True:
  70. # downTime()
  71. '''timer decorator try'''
  72. #===============================================================================
  73. # def my_decor(func):
  74. # def wrapper(*args, **kwargs):
  75. # start = time.time()
  76. # print(start)
  77. # func(*args, **kwargs)
  78. # end = time.time()
  79. # print(end)
  80. # return wrapper
  81. #
  82. # @my_decor
  83. # def file_filter(_ext):
  84. # print('searching files')
  85. # for i in recipisa.setpath(_ext):
  86. # print(i)
  87. # print('nothing found')
  88. #
  89. # file_filter('.py')
  90. #===============================================================================
  91. '''contdown sample h, mins, secs'''
  92. #===============================================================================
  93. # t = 0
  94. # hors, rem = divmod(t, 60)
  95. # mins, secs = divmod(rem, 60)
  96. # timeformat = '{:02d} : {:02d} : {:02d}'.format(hors, mins, secs)
  97. # print(timeformat)
  98. #===============================================================================
  99. '''contdown sample mins, secs'''
  100. # ===============================================================================
  101. # t = 60
  102. # while True:
  103. # rem, hors = divmod(t, 60)
  104. # mins, secs = divmod(rem, 60)
  105. # timeformat = '{:02d} : {:02d} : {:02d}'.format(mins, secs, hors)
  106. # print(timeformat, end='\r')
  107. # t -= 1
  108. # sleep(1)
  109. # ===============================================================================
  110. def count_down(t):
  111. while t >= 0:
  112. mins, secs = divmod(t, 60)
  113. tf = '{:02d}:{:02d}'.format(mins, secs)
  114. print(tf, end='\r')
  115. t -= 1
  116. sleep(1)
  117. else:
  118. print('contdown finished')
  119. count_down(10)