<commit_before>package client

import "github.com/dontpanic92/wxGo/wx"

import "fmt"

//import "time"

const THE_WORKER_ID = wx.ID_HIGHEST + 1

var username, password, team string

type TheFrame struct {
	frame wx.Frame
	sizer wx.BoxSizer
}

func NewTheFrame() TheFrame {
	f := TheFrame{}
	f.frame = wx.NewFrame(wx.NullWindow, -1, "simplecoin.life", wx.DefaultPosition, wx.NewSize(650, 300), wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)

	menubar := wx.NewMenuBar()
	menuFile := wx.NewMenu()
	menuHelp := wx.NewMenu()

	logout := wx.NewMenuItem(menuFile, wx.ID_ANY, "&Logout", "Logout", wx.ITEM_NORMAL)
	menuFile.Append(logout)
	wx.Bind(f.frame, wx.EVT_MENU, f.evtLogout, logout.GetId())

	quit := wx.NewMenuItem(menuFile, wx.ID_ANY, "&Quit", "Quit", wx.ITEM_NORMAL)
	menuFile.Append(quit)
	wx.Bind(f.frame, wx.EVT_MENU, f.evtQuit, quit.GetId())

	menuItemAbout := wx.NewMenuItem(menuFile, wx.ID_ANY, "&About", "About", wx.ITEM_NORMAL)
	menuHelp.Append(menuItemAbout)
	menubar.Append(menuFile, "&File")
	menubar.Append(menuHelp, "&Help")
	f.frame.SetMenuBar(menubar)

	f.sizer = wx.NewBoxSizer(wx.VERTICAL)

	f.frame.SetSizer(f.sizer)

	promptForLogin(&f)

	wx.Bind(f.frame, wx.EVT_THREAD, f.evtThread, THE_WORKER_ID)
	return f
}

func NewLogFrame() TheFrame {
	f := TheFrame{}
	f.frame = wx.NewFrame(wx.NullWindow, -1, "simplecoin.life", wx.NewPoint(200, 70), wx.NewSize(950, 700), wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)

	f.sizer = wx.NewBoxSizer(wx.VERTICAL)

	f.frame.SetSizer(f.sizer)

	grid := wx.NewGrid(f.frame, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
	grid.CreateGrid(20, 5)
	grid.EnableEditing(false)
	grid.EnableGridLines(true)
	grid.SetColLabelValue(0, "created")
	grid.SetColLabelValue(1, "id")
	grid.SetColLabelValue(2, "owner")
	grid.SetColLabelValue(3, "previous")
	grid.SetColLabelValue(4, "transfered")

	db := SqlInit()
	list := TransactionsFrom(db)
	for i, t := range list {
		grid.SetCellValue(i, 0, fmt.Sprintf("%d", t.Created))
		grid.SetCellValue(i, 1, t.Id)
		grid.SetCellValue(i, 2, t.Owner)
		grid.SetCellValue(i, 3, t.Previous)
		grid.SetCellValue(i, 4, fmt.Sprintf("%d", t.Transfered))
	}
	f.sizer.Add(grid, 0, wx.ALL|wx.EXPAND, 5)
	f.frame.Layout()

	wx.Bind(f.frame, wx.EVT_THREAD, f.evtThread, THE_WORKER_ID)
	return f
}

func Setup() {
	wx1 := wx.NewApp()
	f := NewTheFrame()
	f.frame.Show()
	f2 := NewLogFrame()
	f2.frame.Show()
	wx1.MainLoop()
}<commit_msg>words<commit_after>package client

import "github.com/dontpanic92/wxGo/wx"

import "fmt"
import "github.com/justincampbell/timeago"

import "time"

const THE_WORKER_ID = wx.ID_HIGHEST + 1

var username, password, team string

type TheFrame struct {
	frame wx.Frame
	sizer wx.BoxSizer
}

func NewTheFrame() TheFrame {
	f := TheFrame{}
	f.frame = wx.NewFrame(wx.NullWindow, -1, "simplecoin.life", wx.DefaultPosition, wx.NewSize(650, 300), wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)

	menubar := wx.NewMenuBar()
	menuFile := wx.NewMenu()
	menuHelp := wx.NewMenu()

	logout := wx.NewMenuItem(menuFile, wx.ID_ANY, "&Logout", "Logout", wx.ITEM_NORMAL)
	menuFile.Append(logout)
	wx.Bind(f.frame, wx.EVT_MENU, f.evtLogout, logout.GetId())

	quit := wx.NewMenuItem(menuFile, wx.ID_ANY, "&Quit", "Quit", wx.ITEM_NORMAL)
	menuFile.Append(quit)
	wx.Bind(f.frame, wx.EVT_MENU, f.evtQuit, quit.GetId())

	menuItemAbout := wx.NewMenuItem(menuFile, wx.ID_ANY, "&About", "About", wx.ITEM_NORMAL)
	menuHelp.Append(menuItemAbout)
	menubar.Append(menuFile, "&File")
	menubar.Append(menuHelp, "&Help")
	f.frame.SetMenuBar(menubar)

	f.sizer = wx.NewBoxSizer(wx.VERTICAL)

	f.frame.SetSizer(f.sizer)

	promptForLogin(&f)

	wx.Bind(f.frame, wx.EVT_THREAD, f.evtThread, THE_WORKER_ID)
	return f
}

func NewLogFrame() TheFrame {
	f := TheFrame{}
	f.frame = wx.NewFrame(wx.NullWindow, -1, "simplecoin.life", wx.NewPoint(200, 70), wx.NewSize(950, 700), wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL)

	f.sizer = wx.NewBoxSizer(wx.VERTICAL)

	f.frame.SetSizer(f.sizer)

	grid := wx.NewGrid(f.frame, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0)
	grid.CreateGrid(20, 5)
	grid.EnableEditing(false)
	grid.EnableGridLines(true)
	grid.SetColLabelValue(0, "created")
	grid.SetColLabelValue(1, "id")
	grid.SetColLabelValue(2, "owner")
	grid.SetColLabelValue(3, "previous")
	grid.SetColLabelValue(4, "transfered")

	db := SqlInit()
	list := TransactionsFrom(db)
	for i, t := range list {
		tm := time.Unix(t.Created, 0)
		grid.SetCellValue(i, 0, timeago.FromDuration(time.Since(tm)))
		grid.SetCellValue(i, 1, t.Id)
		grid.SetCellValue(i, 2, t.Owner)
		grid.SetCellValue(i, 3, t.Previous)
		if t.Transfered == 0 {
			grid.SetCellValue(i, 4, "")
		} else {
			grid.SetCellValue(i, 4, fmt.Sprintf("%d", t.Transfered))
		}
	}
	f.sizer.Add(grid, 0, wx.ALL|wx.EXPAND, 5)
	f.frame.Layout()

	wx.Bind(f.frame, wx.EVT_THREAD, f.evtThread, THE_WORKER_ID)
	return f
}

func Setup() {
	wx1 := wx.NewApp()
	f := NewTheFrame()
	f.frame.Show()
	f2 := NewLogFrame()
	f2.frame.Show()
	wx1.MainLoop()
}
{'fraction_non_alphanumeric': 0.16541961577350858, 'fraction_numerical': 0.017593528816986854, 'mean_word_length': 4.966224366706876, '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': '6388934', 'n_tokens_mistral': 2189, 'n_tokens_neox': 2085, 'n_words': 354}