diff --git a/peg/main.py b/peg/main.py index e97b4bb..2e4d8fb 100644 --- a/peg/main.py +++ b/peg/main.py @@ -17,25 +17,25 @@ def get_screenshot_name_to_path_map(self, screenshot_names): screenshot_path = os.path.join(self.screenshots_dir, screenshot_name) screenshot_name_to_path_map[screenshot_name] = screenshot_path return screenshot_name_to_path_map - + def open_run_command_window(self): pyautogui.hotkey('win', 'r') - + def open_chrome(self): - open_run_command_window() + self.open_run_command_window() pyautogui.write('chrome') pyautogui.hotkey('enter', interval=3) - def open_file_or_folder_from_run_command_window(self,file_or_folder_path): + def open_file_or_folder_from_run_command_window(self, file_or_folder_path): # open run window - open_run_command_window() + self.open_run_command_window() # write path in run window pyautogui.write(file_or_folder_path) # press enter so that we go to that path pyautogui.hotkey('enter') - def download_file_from_url_using_chrome(self,file_url): - open_chrome() + def download_file_from_url_using_chrome(self, file_url): + self.open_chrome() # We got to enter url section pyautogui.hotkey('alt', 'd') # paste the given file url so that we can download the file @@ -45,3 +45,20 @@ def download_file_from_url_using_chrome(self,file_url): pyautogui.hotkey('ctrl', 's', interval=1) # if window is there then we have to press enter button to download file pyautogui.hotkey('enter') + + def change_power_options(self,screen_off_on_battery, screen_off_when_plugged, sleep_on_battery, + sleep_when_plugged): + self.open_run_command_window() + pyautogui.write('powershell') + pyautogui.hotkey('enter', interval=1) + pyautogui.write(f'powercfg /change monitor-timeout-dc {screen_off_on_battery}') + pyautogui.hotkey('enter', interval=1) + pyautogui.write(f'powercfg /change monitor-timeout-ac {screen_off_when_plugged}') + pyautogui.hotkey('enter', interval=1) + pyautogui.write(f'powercfg /change standby-timeout-dc {sleep_on_battery}') + pyautogui.hotkey('enter', interval=1) + pyautogui.write(f'powercfg /change standby-timeout-ac {sleep_when_plugged}') + pyautogui.hotkey('enter', interval=1) + # close the window + pyautogui.write('exit') + pyautogui.hotkey('enter')