def __init__(self): BuilderAware.__init__(self, join_to_file_dir(__file__, 'history.glade')) self.view.realize() self.activator = Activator() self.activator.bind_accel('window', 'escape', '_Close', 'Escape', self.on_window_delete_event) self.activator.attach(self.window)
def __init__(self, prefs): BuilderAware.__init__(self, join_to_file_dir(__file__, 'editor_prefs.glade')) from snaked.core.manager import keymap self.activator = keymap.get_activator(self.window) self.activator.bind('any', 'escape', None, self.hide) self.prefs = prefs self.original_prefs = prefs.copy() self.langs.append(('default', )) lm = gtksourceview2.language_manager_get_default() for lang_id in sorted(lm.get_language_ids()): self.langs.append((lang_id, )) sm = gtksourceview2.style_scheme_manager_get_default() for style_id in sorted(sm.get_scheme_ids()): self.styles.append((style_id, )) self.checks = ['use-tabs', 'show-right-margin', 'show-line-numbers', 'wrap-text', 'highlight-current-line', 'show-whitespace', 'remove-trailing-space'] for name in self.checks: getattr(self, name.replace('-', '_')).connect( 'toggled', self.on_checkbox_toggled, name) self.margin_width.connect('value-changed', self.on_spin_changed, 'right-margin') self.tab_width.connect('value-changed', self.on_spin_changed, 'tab-width') self.line_spacing.connect('value-changed', self.on_spin_changed, 'line-spacing') self.font.connect('font-set', self.on_font_set, 'font') for h in on_dialog_created_hooks: h(self)
def test_runner_must_return_collected_tests(): result = collect_results(*run_test(join_to_file_dir(__file__), files=['python_test/first.py'])) assert result[0][0] == ('START') assert result[1] == ('COLLECTED_TESTS', ['python_test/first.py::test_first', 'python_test/first.py::test_second', 'python_test/first.py::test_third', 'python_test/first.py::test_fourth'])
def __init__(self): super(QuickOpenDialog, self).__init__(join_to_file_dir(__file__, 'gui.glade')) from snaked.core.manager import keymap self.shortcuts = keymap.get_activator(self.window, 'quick_open') self.shortcuts.bind('any', 'activate-search-entry', 'Activate search entry', self.focus_search) self.shortcuts.bind('any', 'open-mime', 'Run _external editor', self.open_mime).to('<ctrl>Return') self.shortcuts.bind('any', 'open-dialog', '_Open...', self.free_open).to('<ctrl>o') self.shortcuts.bind('any', 'toggle-hidden', 'Toggle _hidden', self.toggle_hidden).to('<ctrl>h') self.shortcuts.bind('any', 'project-list', 'Toggle project _list', self.toggle_projects).to('<ctrl>p', 1) self.shortcuts.bind('projectlist', 'delete', '_Delete project', self.delete_project) self.shortcuts.bind('projectlist', 'set-root', 'Use as _root', self.use_as_root).to('Return', 1) self.shortcuts.bind('any', 'goto-parent', 'Goto p_arent', self.browse_top).to('BackSpace') self.shortcuts.bind('any', 'escape', '_Close', self.escape) self.shortcuts.add_context('projectlist', (), lambda: self.projectlist_tree if self.projectlist_tree.is_focus() else None) project_selection = self.projectlist_tree.get_selection() project_selection.set_mode(gtk.SELECTION_MULTIPLE) project_selection.connect_after('changed', self.on_projectlist_selection_changed) set_activate_the_one_item(self.search_entry, self.filelist_tree) self.roots = []
def __init__(self): super(EditorListDialog, self).__init__(join_to_file_dir(__file__, "gui.glade")) from snaked.core.manager import keymap self.activator = keymap.get_activator(self.window) self.activator.bind("any", "escape", None, self.hide) self.activator.bind("any", "delete", None, self.close_editor) self.block_cursor = False self.path2uri = {} self.paths = [] self.editors_view.set_search_equal_func(search_func) self.editors_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE) self.model = gtk.ListStore(str, int, str, object, str) self.editors_view.set_model(self.model) self.mnemonic_renderer.set_property("yalign", 0.5) self.mnemonic_renderer.set_property("weight", pango.WEIGHT_BOLD) self.mnemonic_renderer.set_property("width", 5) self.mnemonic_hole.set_property("width", 20) for m in mnemonics: self.activator.bind("any", "activate-mnemonic-" + m, None, self.mnemonic_activate, m).to("<alt>" + m)
def __init__(self): BuilderAware.__init__(self, join_to_file_dir(__file__, 'places.glade')) from fmd.app import keymap self.activator = keymap.get_activator(self.window) self.activator.bind('any', 'escape', '_Close', self.on_window_delete_event).to('Escape') self.view.realize()
def on_editor_get_project_larva(editor): from uxie.utils import join_to_file_dir import os.path if os.path.exists(join_to_file_dir(editor.uri, '__init__.py')): editor.get_project_larva.stop_emission() root, packages = get_package_root(editor.uri) return os.path.join(root, packages.partition('.')[0])
def test_runner_must_return_right_status_for_failed_collect(): result = collect_results(*run_test(join_to_file_dir(__file__), files=['python_test/module_with_errors.py'])) assert result[1][0] == 'FAILED_COLLECT' assert result[1][1] == 'python_test/module_with_errors.py' assert result[1][3] == [('python_test/module_with_errors.py', 4)] assert 'NameError' in result[1][2]
def modify_lang_search_path(self, manager): search_path = manager.get_search_path() user_path = os.path.expanduser('~') for i, p in enumerate(search_path): if not p.startswith(user_path): break search_path.insert(i, join_to_file_dir(__file__, 'lang-specs')) manager.set_search_path(search_path)
def __init__(self): BuilderAware.__init__(self, join_to_file_dir(__file__, 'prefs.glade')) from snaked.core.shortcuts import ShortcutActivator self.activator = ShortcutActivator(self.window) self.activator.bind('Escape', self.hide) self.activator.bind('<alt>s', self.focus_search) set_activate_the_one_item(self.search_entry, self.dialogs_view)
def __init__(self): super(OutlineDialog, self).__init__(join_to_file_dir(__file__, 'outline.glade')) from snaked.core.manager import keymap self.activator = keymap.get_activator(self.window) self.activator.bind('any', 'escape', None, self.hide) self.activator.bind('any', 'activate-search-entry', None, self.focus_search) set_activate_the_one_item(self.search_entry, self.outline_tree)
def __init__(self, existing_snippets): BuilderAware.__init__(self, join_to_file_dir(__file__, 'prefs.glade')) from snaked.core.manager import keymap self.activator = keymap.get_activator(self.window) self.activator.bind('Escape', self.hide) self.activator.bind('<alt>s', self.focus_search) self.existing_snippets = existing_snippets set_activate_the_one_item(self.search_entry, self.snippets_view)
def __init__(self): BuilderAware.__init__(self, join_to_file_dir(__file__, 'select_session.glade')) from snaked.core.prefs import get_settings_path self.dialog.vbox.remove(self.dialog.action_area) self.dialog.set_default_response(1) cfg = get_settings_path('') for p in os.listdir(cfg): if os.path.isdir(os.path.join(cfg, p)): self.sessions.append((p,))
def test_runner_must_return_runned_test_results(): result = collect_results(*run_test(join_to_file_dir(__file__), files=['python_test/first.py'])) assert result[2] == ('ITEM_CALL', 'python_test/first.py::test_first') assert result[3] == ('PASS', 'python_test/first.py::test_first') assert result[6] == ('ITEM_CALL', 'python_test/first.py::test_third') assert result[7] == ('SKIP', 'python_test/first.py::test_third') assert result[5][:2] == ('FAIL', 'python_test/first.py::test_second') assert 'AssertionError' in result[5][2] assert result[9][:2] == ('FAIL', 'python_test/first.py::test_fourth') assert 'AttributeError' in result[9][2]
def __init__(self): super(TestRunner, self).__init__(join_to_file_dir(__file__, 'pytest_runner.glade')) self.buffer = gtk.TextBuffer() self.view = gtk.TextView() self.view.set_buffer(self.buffer) self.view.set_editable(False) self.view.set_wrap_mode(gtk.WRAP_WORD) self.buffer_place.add(self.view) self.view.show() self.original_progress_color = self.progress.get_style().bg[gtk.STATE_SELECTED] self.editor_ref = None self.timer_id = None self.test_proc = None self.collected_nodes = {} self.failed_nodes = {} self.nodes_traces = {} self.nodes_buffer_positions = {} self.panel.hide()
def test_runner_must_ignore_skipped_collected_items(): result = collect_results(*run_test(join_to_file_dir(__file__), None, 'test_first', files=['python_test/first.py'])) assert result[1] == ('COLLECTED_TESTS', ['python_test/first.py::test_first'])
def test_runner_must_return_output_of_failed_tests(): result = collect_results(*run_test(join_to_file_dir(__file__), files=['python_test/first.py'], match='test_second')) assert 'test-second-output' in result[3][2]
def __init__(self): BuilderAware.__init__(self, join_to_file_dir(__file__, 'plugin_prefs.glade')) from snaked.core.manager import keymap self.activator = keymap.get_activator(self.window) self.activator.bind('any', 'escape', None, self.hide)