How to use _get_windows method in pyatom

Best Python code snippet using pyatom_python

preferences.py

Source:preferences.py Github

copy

Full Screen

...35 self._init_scheme_combo()36 self._init_values()37 self.set_transient_for(parent)38 self.set_default_response(Gtk.ResponseType.CLOSE)39 def _get_windows(self):40 return nfoview.app.get_windows() if hasattr(nfoview, "app") else []41 def _init_font_button(self):42 def monospace(family, *args, **kwargs):43 return family.is_monospace()44 self._font_button.set_filter_func(monospace, None)45 def _init_scheme_combo(self):46 self._scheme_combo.clear()47 store = Gtk.ListStore(object, str)48 self._scheme_combo.set_model(store)49 renderer = Gtk.CellRendererText()50 self._scheme_combo.pack_start(renderer, expand=True)51 self._scheme_combo.add_attribute(renderer, "text", 1)52 for scheme in nfoview.schemes.get_all():53 store.append((scheme, scheme.label))54 def _init_values(self):55 self._font_button.set_font(nfoview.conf.font)56 pixels = nfoview.conf.pixels_above_lines57 self._line_spacing_spin.set_value(pixels)58 store = self._scheme_combo.get_model()59 for i, (scheme, label) in enumerate(store):60 if scheme.name == nfoview.conf.color_scheme:61 self._scheme_combo.set_active(i)62 self._update_color_buttons(scheme)63 self._update_sensitivities()64 def _on_bg_color_button_color_set(self, color_button):65 color = color_button.get_rgba()66 color = nfoview.util.rgba_to_hex(color)67 nfoview.conf.background_color = color68 scheme = nfoview.schemes.get("custom")69 scheme.background = color70 for window in self._get_windows():71 window.view.update_style()72 def _on_fg_color_button_color_set(self, color_button):73 color = color_button.get_rgba()74 color = nfoview.util.rgba_to_hex(color)75 nfoview.conf.foreground_color = color76 scheme = nfoview.schemes.get("custom")77 scheme.foreground = color78 for window in self._get_windows():79 window.view.update_style()80 def _on_font_button_font_set(self, font_button):81 nfoview.conf.font = font_button.get_font()82 for window in self._get_windows():83 window.view.update_style()84 def _on_line_spacing_spin_value_changed(self, spin_button):85 pixels = spin_button.get_value_as_int()86 nfoview.conf.pixels_above_lines = pixels87 for window in self._get_windows():88 window.view.set_pixels_above_lines(pixels)89 def _on_link_color_button_color_set(self, color_button):90 color = color_button.get_rgba()91 color = nfoview.util.rgba_to_hex(color)92 nfoview.conf.link_color = color93 scheme = nfoview.schemes.get("custom")94 scheme.link = color95 for window in self._get_windows():96 window.view.update_style()97 def _on_scheme_combo_changed(self, combo_box):98 store = combo_box.get_model()99 index = combo_box.get_active()100 scheme = store[index][0]101 nfoview.conf.color_scheme = scheme.name102 self._update_color_buttons(scheme)103 for window in self._get_windows():104 window.view.update_style()105 self._update_sensitivities()106 def _on_vlink_color_button_color_set(self, color_button):107 color = color_button.get_rgba()108 color = nfoview.util.rgba_to_hex(color)109 nfoview.conf.visited_link_color = color110 scheme = nfoview.schemes.get("custom")111 scheme.vlink = color112 for window in self._get_windows():113 window.view.update_style()114 def _update_color_buttons(self, scheme):115 rgba = nfoview.util.hex_to_rgba116 self._bg_color_button.set_rgba(rgba(scheme.background))117 self._fg_color_button.set_rgba(rgba(scheme.foreground))118 self._link_color_button.set_rgba(rgba(scheme.link))119 self._vlink_color_button.set_rgba(rgba(scheme.visited_link))120 def _update_sensitivities(self):121 sensitive = (nfoview.conf.color_scheme == "custom")122 self._bg_color_button.set_sensitive(sensitive)123 self._bg_color_label.set_sensitive(sensitive)124 self._fg_color_button.set_sensitive(sensitive)125 self._fg_color_label.set_sensitive(sensitive)126 self._link_color_button.set_sensitive(sensitive)...

Full Screen

Full Screen

window.py

Source:window.py Github

copy

Full Screen

...9 self.window = None10 else:11 self.window = int(window_range)12 self.increment_window = increment_window13 self.windows = self._get_windows()14 self.num_of_windows = len(self.windows)15 def _get_windows(self):16 windows = []17 self.windows_dict = {} # looks duplicated, but this is required for easier downstream retrieval18 if self.window:19 window_size = self.window20 windows.append((self.allele_of_interest - window_size/2,21 self.allele_of_interest + window_size/2))22 self.windows_dict[window_size] = (self.allele_of_interest - window_size/2,23 self.allele_of_interest + window_size/2)24 else:25 window_size = self.smallest_window26 while window_size < self.largest_window:27 windows.append((self.allele_of_interest - window_size/2,28 self.allele_of_interest + window_size/2))29 self.windows_dict[window_size] = (self.allele_of_interest - window_size/2,...

Full Screen

Full Screen

custom_kill.py

Source:custom_kill.py Github

copy

Full Screen

...4import i3ipc5from i3_helpers import sh6CTRL_Q = ['Slack', 'discord']7CUSTOM = ['Chromium', 'Brave-browser']8def _get_windows(i3, which='all', get_ws=False):9 tree = i3.get_tree()10 focused_win = tree.find_focused()11 if which == 'focused':12 windows = [focused_win]13 elif which == 'all':14 windows = [win for ws in tree.workspaces() for win in ws.leaves()]15 if get_ws:16 return windows, focused_win.workspace().name17 else:18 return windows19def kill_custom(i3, which):20 """Kill apps differently according to their class."""21 windows, focused_ws = _get_windows(i3, which, get_ws=True)22 for win in windows:23 i3.command(f'[con_id={win.id}] focus')24 win_class = win.window_class25 if win_class in CUSTOM:26 sh(f'xdotool key --window {win.window} comma+k+v')27 # If the window was not killed using xdotool then do kill it with i328 remaining_window_classes = [win.window_class for win in _get_windows(i3)]29 if win_class in remaining_window_classes:30 i3.command('kill')31 elif win_class in CTRL_Q:32 sh(f'xdotool key --window {win.window} ctrl+q')33 else:34 i3.command('kill')35 i3.command(f'workspace {focused_ws}')36if __name__ == '__main__':37 import argparse38 parser = argparse.ArgumentParser()39 parser.add_argument('--which', '-w', default='focused')40 pars_args = parser.parse_args()41 i3_conn = i3ipc.Connection()42 kill_custom(i3_conn, which=pars_args.which)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful