def _check_desktop_link(self): desktop_path = a2ahk.call_lib_cmd('get_desktop_link_path') if not desktop_path: self.ui.add_desktop_shortcut.setChecked(False) else: desktop_path = os.path.normpath(desktop_path) is_current_path = desktop_path == self.a2.paths.a2uiexe self.ui.add_desktop_shortcut.setChecked(is_current_path)
def pick_scope_info(self): scope_nfo_string = a2ahk.call_lib_cmd('pick_scope_nfo') try: title, class_name, process = scope_nfo_string.split('\\n') scope_string = get_scope_string(title, class_name, process) self.add_scope(scope_string) except ValueError: pass
def _check_win_startup(self): startup_path = a2ahk.call_lib_cmd('get_win_startup_path') if not startup_path: self.ui.load_on_win_start.setChecked(False) else: startup_path = os.path.normpath(startup_path) is_current_path = startup_path == self.a2.paths.a2exe if not is_current_path: log.warn('Different Windows Startup path set!\n %s' % startup_path) self.ui.load_on_win_start.setChecked(is_current_path)
def _fetch_window_process_list(self): scope_nfo = a2ahk.call_lib_cmd('get_scope_nfo') scope_nfo = scope_nfo.split('\\n') if not scope_nfo: log.error('Error getting scope_nfo!! scope_nfo: %s' % scope_nfo) return processes = set() num_items = len(scope_nfo) num_items -= num_items % 3 for i in range(0, num_items, 3): if scope_nfo[i + 2]: processes.add(scope_nfo[i + 2]) self._process_list = sorted(processes, key=lambda x: x.lower()) for name in self._process_list: self._process_menu.addAction(name, partial(self.add_process, name))
def get_scope_data(self): # call AHK script to get all window classes, titles and executables scope_nfo = a2ahk.call_lib_cmd('get_scope_nfo') scope_nfo = scope_nfo.split('\\n') if not scope_nfo: log.error('Error getting scope_nfo!! scope_nfo: %s' % scope_nfo) return self.system_scope_data = dict([(n, set()) for n in SCOPE_ITEMS]) self.system_scope_data['__all'] = set() num_items = len(scope_nfo) num_items -= num_items % 3 for i in range(0, num_items, 3): self.system_scope_data['__all'].add((scope_nfo[i], scope_nfo[i + 1], scope_nfo[i + 2])) for j in range(3): this_value = scope_nfo[i + j] if this_value: self.system_scope_data[SCOPE_ITEMS[j]].add(this_value)
def get_scope_data(self): # call AHK script to get all window classes, titles and executables scope_nfo = a2ahk.call_lib_cmd('get_scope_nfo') scope_nfo = scope_nfo.split('\\n') if not scope_nfo: log.error('Error getting scope_nfo!! scope_nfo: %s' % scope_nfo) return self.system_scope_data = dict([(n, set()) for n in SCOPE_ITEMS]) self.system_scope_data['__all'] = set() num_items = len(scope_nfo) num_items -= num_items % 3 for i in range(0, num_items, 3): self.system_scope_data['__all'].add( (scope_nfo[i], scope_nfo[i + 1], scope_nfo[i + 2])) for j in range(3): this_value = scope_nfo[i + j] if this_value: self.system_scope_data[SCOPE_ITEMS[j]].add(this_value)
def _set_desktop_link(self, state): a2ahk.call_lib_cmd('set_desktop_link', self.a2.paths.a2, int(state))
def _set_windows_startup(self, state): a2ahk.call_lib_cmd('set_windows_startup', self.a2.paths.a2, int(state))
def pick(self): text = a2ahk.call_lib_cmd('get_coordinates') self.set_string_value(text)