<commit_before>from jinja2 import Template
import webkit
import re
import gtk
import json
from inspector import Inspector


class WebkitPony(gtk.Window):
    '''Main Gui component. Creates the GTK window and loads the webgui. This
    is the main entrypoint of the gui client. Actually the real gui, where
    events and actions take place, lives in lib.view.webgui.
    '''
    
    
    def __init__(self, settings):
        '''Init a window, set size and instantiate the webgui.
        '''
        gtk.Window.__init__(self)
        
        self.webgui =  WebGui(settings)
        self.connect("destroy", self.destroy)
        self.add(self.webgui)
        self.show_all()
        
        if settings.DEBUG:
            webkitsettings = self.webgui.get_settings()
            webkitsettings.set_property("enable-developer-extras", True)
            inspector = Inspector(self.webgui.get_web_inspector())
        else:
            webview.props.settings.props.enable_default_context_menu = False
        
        self.set_size_request(settings.WIDTH, settings.HEIGHT)
        self.set_resizable(False)
        self.show_all()
      
    def destroy(self, widget, data=None):
        gtk.main_quit()
        


class WebGui(webkit.WebView):
    '''
    Gui componet to embed webguis in desktop application. Listens for
    all click events and tries to map the clicked url views defined in urls.py.
    '''
    
    def __init__(self, settings):
        webkit.WebView.__init__(self)
        self.settings = settings
        self.connect('navigation-policy-decision-requested', self.on_link_clicked)
        self.connect('title-changed', self.on_title_changed)
        self.dispatch_action('', self)
        <commit_msg>-resizability and app title now configurable via settings<commit_after>from jinja2 import Template
import webkit
import re
import gtk
import json
from inspector import Inspector


class WebkitPony(gtk.Window):
    '''Main Gui component. Creates the GTK window and loads the webgui. This
    is the main entrypoint of the gui client. Actually the real gui, where
    events and actions take place, lives in lib.view.webgui.
    '''
    
    
    def __init__(self, settings):
        '''Init a window, set size and instantiate the webgui.
        '''
        gtk.Window.__init__(self)
        
        self.webgui =  WebGui(settings)
        self.connect("destroy", self.destroy)
        self.add(self.webgui)
        self.show_all()
        
        if settings.DEBUG:
            webkitsettings = self.webgui.get_settings()
            webkitsettings.set_property("enable-developer-extras", True)
            inspector = Inspector(self.webgui.get_web_inspector())
        else:
            webview.props.settings.props.enable_default_context_menu = False
        
        self.set_size_request(settings.WIDTH, settings.HEIGHT)
        self.set_resizable(getattr(settings, 'RESIZABLE', False))
        self.set_title(getattr(settings, 'TITLE', 'Webkit Pony App'))
        self.show_all()
      
    def destroy(self, widget, data=None):
        gtk.main_quit()
        


class WebGui(webkit.WebView):
    '''
    Gui componet to embed webguis in desktop application. Listens for
    all click events and tries to map the clicked url views defined in urls.py.
    '''
    
    def __init__(self, settings):
        webkit.WebView.__init__(self)
        self.settings = settings
        self.connect('navigation-policy-decision-requested', self.on_link_clicked)
        self.connect('title-changed', self.on_title_changed)
        self.dispatch_action('', self)
        
{'fraction_non_alphanumeric': 0.08908685968819599, 'fraction_numerical': 0.0005567928730512249, 'mean_word_length': 2.546890424481737, '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': '3556116', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1013, 'n_words': 270}