def _process_recognition(self, node, extras):  # Callback when command is spoken.
     windows = Window.get_all_windows()
     #windows.sort(key=lambda x: x.executable)
     for window in windows:
         if utils.windowIsValid(window):
             executable = unicode(window.executable, errors='ignore').lower()
             title = unicode(window.title, errors='ignore').lower()
             print "{:7} : {:75} : {}".format(window.handle, executable, title)
Пример #2
0
 def _process_recognition(self, node,
                          extras):  # Callback when command is spoken.
     windows = Window.get_all_windows()
     #windows.sort(key=lambda x: x.executable)
     for window in windows:
         if utils.windowIsValid(window):
             print "{:7} : {:75} : {}".format(
                 window.handle, window.executable.encode("utf-8"),
                 window.title.encode("utf-8"))
Пример #3
0
def script():
    X = in_data.X
    y = in_data.Y
    feat_names = [x.name for x in in_data.domain.attributes]
    new_feat_names = [x.split('=')[-1] for x in feat_names]
    print(feat_names)
    model_type = str(in_learners).split(',')[0].split('(')[0][1:]
    is_cont = in_data.domain.class_var.is_continuous
    class_type = 'regression' if is_cont else 'classification'
    class_names = in_data.domain.class_var.values if not is_cont else None

    shap_values = in_object
    biggest_val = np.amax(np.absolute(shap_values))

    shap_values = shap_values / biggest_val
    xrange = (-1.1, 1.1)
    num_rows_2_sample = shap_values.shape[0]
    max_display = shap_values.shape[1]
    font_size = 13

    idx = np.random.choice(list(range(shap_values.shape[0])),
                           size=num_rows_2_sample,
                           replace=False)
    shap_values = shap_values[idx, :]
    X = X[idx, :]

    if type(shap_values) == list:
        shap_values = shap_values[class_val]
        title = '{0} is {1}'.format(in_data.domain.class_var.name,
                                    class_names[class_val])
    else:
        title = in_data.domain.class_var.name

    id = len(Window.get_all_windows())
    summary_plot(shap_values,
                 features=X,
                 feature_names=feat_names,
                 class_names=class_names,
                 max_display=max_display,
                 plot_type='bar',
                 color='black',
                 id=id,
                 xrange=xrange)
    summary_plot(shap_values,
                 features=X,
                 feature_names=feat_names,
                 class_names=class_names,
                 max_display=max_display,
                 plot_type='dot',
                 title=title,
                 id=id,
                 xrange=xrange)

    return None, None, None, None
Пример #4
0
def get_default_window(name):
    executable, title = default_names[name]
    if executable: executable = executable.lower()
    if title: title = title.lower()
    windows = Window.get_all_windows()
    for window in windows:
        if not window.is_visible:
            continue
        elif executable and window.executable.lower().find(executable) == -1:
            continue
        elif title and window.title.lower().find(title) == -1:
            continue
        window.name = name
        win_names[name] = window
        return window
    return None
Пример #5
0
def clear_log():
    # Function to clear natlink status window
    try:
        # pylint: disable=import-error
        import natlink
        windows = Window.get_all_windows()
        matching = [
            w for w in windows if b"Messages from Python Macros" in w.title
        ]
        if matching:
            handle = (matching[0].handle)
            rt_handle = win32gui.FindWindowEx(handle, None, "RICHEDIT", None)
            win32gui.SetWindowText(rt_handle, "")
            return
    except Exception as e:
        print(e)
Пример #6
0
def get_default_window(name):
    executable, title = default_names[name]
    if executable: executable = executable.lower()
    if title: title = title.lower()
    windows = Window.get_all_windows()
    for window in windows:
        if not window.is_visible:
            continue
        elif executable and window.executable.lower().find(executable) == -1:
            continue
        elif title and window.title.lower().find(title) == -1:
            continue
        window.name = name
        win_names[name] = window
        return window
    return None
Пример #7
0
from dragonfly import Window
print(Window.get_all_windows())
Пример #8
0
def move_desktop_to(n):
    for window in Window.get_all_windows():
        if vda.IsWindowOnCurrentVirtualDesktop(window.handle):
            vda.MoveWindowToDesktopNumber(window.handle, n - 1)