<commit_before>import weakref

import gtk

import snaked.core.shortcuts
import snaked.core.editor

class WindowedEditorManager(snaked.core.editor.EditorManager):
    def __init__(self):
        super(WindowedEditorManager, self).__init__()
        self.windows = weakref.WeakKeyDictionary()
        self.activators = weakref.WeakKeyDictionary()

    def on_window_destroy(self, window, editor):
        editor().editor_closed.emit()

    def manage_editor(self, editor):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.add(editor.widget)
        
        editor.view.grab_focus()
        
        weak_editor = weakref.ref(editor)
        def ctx():
            return (weak_editor(), )
        
        activator = snaked.core.shortcuts.ContextShortcutActivator(window, ctx)
        self.windows[editor] = window
        self.activators[editor] = activator

        window.connect('destroy', self.on_window_destroy, weak_editor)
        window.show()
       
    def focus_editor(self, editor):
        self.windows[editor].present()
        
    def set_editor_title(self, editor, title):
        self.windows[editor].set_title(title)
        
    def close_editor(self, editor):
        self.windows[editor].destroy()

    def set_editor_shortcuts(self, editor):
        activator = self.activators[editor]
        self.plugin_manager.bind_shortcuts(activator, editor)

        activator.bind_to_name('quit', self.quit)
        activator.bind_to_name('close-window', self.close_editor)
        activator.bind_to_name('save', self.save)
        activator.bind_to_name('new-file', self.new_file_action)

        activator.bind_to_name('show-preferences', self.show_preferences)

        activator.bind('Escape', self.process_escape)

    def save(self, editor):
        editor.save()

    def set_transient_for(self, editor, window):
        window.set_transient_for(self.windows[editor])<commit_msg>default window sizes in windowed mode<commit_after>import weakref

import gtk

import snaked.core.shortcuts
import snaked.core.editor

class WindowedEditorManager(snaked.core.editor.EditorManager):
    def __init__(self):
        super(WindowedEditorManager, self).__init__()
        self.windows = weakref.WeakKeyDictionary()
        self.activators = weakref.WeakKeyDictionary()

    def on_window_destroy(self, window, editor):
        editor().editor_closed.emit()

    def manage_editor(self, editor):
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_default_size(800, 550)
        window.add(editor.widget)
        
        editor.view.grab_focus()
        
        weak_editor = weakref.ref(editor)
        def ctx():
            return (weak_editor(), )
        
        activator = snaked.core.shortcuts.ContextShortcutActivator(window, ctx)
        self.windows[editor] = window
        self.activators[editor] = activator

        window.connect('destroy', self.on_window_destroy, weak_editor)
        window.show_all()
       
    def focus_editor(self, editor):
        self.windows[editor].present()
        
    def set_editor_title(self, editor, title):
        self.windows[editor].set_title(title)
        
    def close_editor(self, editor):
        self.windows[editor].destroy()

    def set_editor_shortcuts(self, editor):
        activator = self.activators[editor]
        self.plugin_manager.bind_shortcuts(activator, editor)

        activator.bind_to_name('quit', self.quit)
        activator.bind_to_name('close-window', self.close_editor)
        activator.bind_to_name('save', self.save)
        activator.bind_to_name('new-file', self.new_file_action)

        activator.bind_to_name('show-preferences', self.show_preferences)

        activator.bind('Escape', self.process_escape)

    def save(self, editor):
        editor.save()

    def set_transient_for(self, editor, window):
        window.set_transient_for(self.windows[editor])
{'fraction_non_alphanumeric': 0.10604508196721311, 'fraction_numerical': 0.0015368852459016393, 'mean_word_length': 2.9887640449438204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1424976', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1152, 'n_words': 182}