<commit_before># INSERT LICENSE HEADER HERE

import gtk
import gtk.glade
import config
import gobject

widgets = None

def addCategory(store, category):
	""" add parent item to store and return the treeiter """
	iter = store.append(None, (category,"",""))

	return iter

def fillConfigView():
	configView = widgets.get_widget("configView")
	configStore = configView.get_model()

	for category in ("tekka","colors","chatting"):
		cDict = config.get(category, default=None)

		if not cDict:
			continue

		iter = addCategory(configStore, category)

		if not iter:
			continue

		for (key, value) in cDict.items():
			default = str(config.getDefault(category, key))
			configStore.append(iter, row=(key, value, default))

def renderOption(column, cell, model, iter):
	pass

def renderValue(column, cell, model, iter):
	pass

def renderDefaultValue(column, cell, model, iter):
	pass

def setup():
	""" called initially """
	global widgets
	gladePath = config.get("gladefiles", "dialogs") + "advancedPreferences.glade"
	widgets = gtk.glade.XML(gladePath)

	configView = widgets.get_widget("configView")

	c = 0
	for name in ("Option", "Value", "Default Value"):
		renderer = gtk.CellRendererText()

		column = gtk.TreeViewColumn(name, renderer, text=c)

		# set custom rendering function (render<key>)
		column.set_cell_data_func(renderer,
				eval("render%s" % name.replace(" ","")))

		configView.append_column(column)
		c+=1

	store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
			gobject.TYPE_STRING)

	configView.set_model(store)

def run():
	dialog = widgets.get_widget("advancedPreferences")

	fillConfigView()

	dialog.run()
	dialog.destroy()
<commit_msg>Added bold markup for categories in adv. preferences<commit_after># INSERT LICENSE HEADER HERE

import gtk
import gtk.glade
import config
import gobject
import pango

widgets = None

def addCategory(store, category):
	""" add parent item to store and return the treeiter """
	iter = store.append(None, (category,"",""))

	return iter

def fillConfigView():
	configView = widgets.get_widget("configView")
	configStore = configView.get_model()

	for category in ("tekka","colors","chatting"):
		cDict = config.get(category, default=None)

		if not cDict:
			continue

		iter = addCategory(configStore, category)

		if not iter:
			continue

		for (key, value) in cDict.items():
			default = str(config.getDefault(category, key))
			configStore.append(iter, row=(key, value, default))

def renderOption(column, renderer, model, iter):
	if not model.iter_parent(iter):
		# category row, markup bold
		renderer.set_property("weight", pango.WEIGHT_BOLD)
	else:
		renderer.set_property("weight", pango.WEIGHT_NORMAL)

def renderValue(column, renderer, model, iter):
	pass

def renderDefaultValue(column, renderer, model, iter):
	pass

def setup():
	""" called initially """
	global widgets
	gladePath = config.get("gladefiles", "dialogs") + "advancedPreferences.glade"
	widgets = gtk.glade.XML(gladePath)

	configView = widgets.get_widget("configView")

	c = 0
	for name in ("Option", "Value", "Default Value"):
		renderer = gtk.CellRendererText()

		column = gtk.TreeViewColumn(name, renderer, text=c)

		# set custom rendering function (render<key>)
		column.set_cell_data_func(renderer,
				eval("render%s" % name.replace(" ","")))

		configView.append_column(column)
		c+=1

	store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
			gobject.TYPE_STRING)

	configView.set_model(store)

def run():
	dialog = widgets.get_widget("advancedPreferences")

	fillConfigView()

	dialog.run()
	dialog.destroy()

{'fraction_non_alphanumeric': 0.1285634432643935, 'fraction_numerical': 0.0011179429849077697, 'mean_word_length': 5.160068846815835, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '642218', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1158, 'n_words': 294}