<commit_before># -*- coding: utf-8 -*-
'''
Add(self, item, tuple pos, tuple span=wx.DefaultSpan, integer flag=0, 
    integer border=0, userData=None)
'''

import wx

import sys
import backend


class Main(wx.Frame):
    'The application window'

    def __init__(self):
        super(Main, self).__init__(None, -1, title="Enclave", size=(600, 500))
        self.Bind(wx.EVT_IDLE, self.call_api)

        self.init_ui()
        self.Show()

        self.init_backend()

    def init_ui(self):
        'Deals with setting up the GUI'
        self.panel = wx.Panel(self)

        self.grid = wx.GridBagSizer(5, 10)

        self.friendlist = wx.ListBox(self.panel)
        self.grid.Add(self.friendlist, (0, 0), span=(6, 2), flag=wx.EXPAND)

        self.button_ignore = wx.Button(self.panel, label="Ignore", size=(90, 28))
        self.button_add = wx.Button(self.panel, label="Add", size=(90, 28))
        self.grid.Add(self.button_ignore, pos=(6, 0), flag=wx.BOTTOM)
        self.grid.Add(self.button_add, pos=(6, 1))

        self.message = wx.TextCtrl(self.panel)
        self.grid.Add(self.message, pos=(6, 2), span=(1, 4), flag=wx.EXPAND | wx.RIGHT)

        self.log = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.grid.Add(self.log, pos=(2, 2), span=(4, 4), flag=wx.EXPAND)

        self.ipshow = wx.TextCtrl(self.panel, value='fc00:e968:6179::de52:7100', style=wx.TE_READONLY)
        self.grid.Add(self.ipshow, pos=(0, 2), span=(1, 4), flag=wx.EXPAND)

        self.statusmenu = wx.ComboBox(self.panel, choices=['Available'], style=wx.CB_READONLY)
        self.grid.Add(self.statusmenu, pos=(1, 2), span=(1, 1))

        self.statusmsg = wx.TextCtrl(self.panel)
        self.grid.Add(self.statusmsg, pos=(1, 3), span=(1, 3), flag=wx.EXPAND)

        self.grid.AddGrowableRow(2)
        self.grid.AddGrowableCol(3)

        self.panel.SetSizerAndFit(self.grid)

    def init_backend(self):
        try:
            address = backend.get_address()
            if address is None:
                raise Exception

        except Exception:
            wx.MessageBox('No cjdns interface detected!', 'Error',
                          wx.OK | wx.ICON_ERROR)
            sys.exit(1)

        self.ipshow.ChangeValue(address)

    def call_api(self, event):
        'An idle event handler, handles calls to the backend'


if __name__ == '__main__':
    app = wx.App(False)
    Main()
    app.MainLoop()
<commit_msg>Modified GUI to add a method to set alias<commit_after># -*- coding: utf-8 -*-
'''
Add(self, item, tuple pos, tuple span=wx.DefaultSpan, integer flag=0,
    integer border=0, userData=None)
'''

import wx

import sys
import backend


class Main(wx.Frame):
    'The application window'

    def __init__(self):
        super(Main, self).__init__(None, -1, title="Enclave", size=(600, 500))
        self.Bind(wx.EVT_IDLE, self.call_api)

        self.init_ui()
        self.Show()

        self.init_backend()

    def init_ui(self):
        'Deals with setting up the GUI'
        self.panel = wx.Panel(self)

        self.grid = wx.GridBagSizer(5, 10)

        self.ipshow = wx.TextCtrl(self.panel,
            value='ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
            style=wx.TE_READONLY)
        self.grid.Add(self.ipshow, pos=(0, 0), span=(1, 2), flag=wx.EXPAND)

        self.friendlist = wx.ListBox(self.panel)
        self.grid.Add(self.friendlist, (1, 0), span=(5, 2), flag=wx.EXPAND)

        self.button_ignore = wx.Button(self.panel,
            label="Ignore", size=(90, 28))
        self.button_add = wx.Button(self.panel, label="Add", size=(90, 28))
        self.grid.Add(self.button_ignore, pos=(6, 0), flag=wx.BOTTOM)
        self.grid.Add(self.button_add, pos=(6, 1))

        self.message = wx.TextCtrl(self.panel)
        self.grid.Add(self.message, pos=(6, 2), span=(1, 4),
            flag=wx.EXPAND | wx.RIGHT)

        self.setalias = wx.TextCtrl(self.panel, value="Anon")
        self.grid.Add(self.setalias, pos=(0, 2), span=(1, 4),
            flag=wx.EXPAND)

        self.log = wx.TextCtrl(self.panel,
            style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.grid.Add(self.log, pos=(2, 2), span=(4, 4), flag=wx.EXPAND)

        self.statusmenu = wx.ComboBox(self.panel, choices=['Available'],
            style=wx.CB_READONLY)
        self.grid.Add(self.statusmenu, pos=(1, 2), span=(1, 1))

        self.statusmsg = wx.TextCtrl(self.panel)
        self.grid.Add(self.statusmsg, pos=(1, 3), span=(1, 3), flag=wx.EXPAND)

        self.grid.AddGrowableRow(2)
        self.grid.AddGrowableCol(3)

        self.panel.SetSizerAndFit(self.grid)

    def init_backend(self):
        try:
            address = backend.get_address()
            if address is None:
                raise Exception

        except Exception:
            wx.MessageBox('No cjdns interface detected!', 'Error',
                          wx.OK | wx.ICON_ERROR)
            sys.exit(1)

        self.ipshow.ChangeValue(address)

    def call_api(self, event):
        'An idle event handler, handles calls to the backend'


if __name__ == '__main__':
    app = wx.App(False)
    Main()
    app.MainLoop()

{'fraction_non_alphanumeric': 0.1503293297171639, 'fraction_numerical': 0.023827973653622627, 'mean_word_length': 2.47911051212938, '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': '1496226', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1757, 'n_words': 349}