Commit c39bb7de authored by Hugo Sena Ribeiro's avatar Hugo Sena Ribeiro

set pane inside unsafe_set

parent 8e3458a6
......@@ -1394,18 +1394,17 @@ class DirDiff(MeldDoc, Component):
isdir = [os.path.isdir(files[j]) for j in range(self.model.ntree)]
for j in range(self.model.ntree):
column = functools.partial(self.model.column_index, pane=j)
if stats[j]:
it, j, state, isdir[j], display_text=name_overrides[j])
emblem = EMBLEM_NEW if j in newest else None
link_emblem = EMBLEM_SYMLINK if j in symlinks else None
self.model.unsafe_set(it, {
column(COL_EMBLEM): emblem,
column(COL_EMBLEM_SECONDARY): link_emblem,
column(COL_TIME): times[j],
column(COL_SIZE): sizes[j],
column(COL_PERMS): perms[j],
self.model.unsafe_set(it, j, {
COL_EMBLEM: emblem,
COL_TIME: times[j],
COL_SIZE: sizes[j],
COL_PERMS: perms[j]
# TODO: More consistent state setting here would let us avoid
......@@ -129,23 +129,19 @@ class DiffTreeStore(SearchableTreeStore):
def add_entries(self, parent, names):
it = self.append(parent)
for pane, path in enumerate(names):
column = self.column_index(COL_PATH, pane)
self.unsafe_set(it, {column: path})
self.unsafe_set(it, pane, {COL_PATH: path})
return it
def add_empty(self, parent, text="empty folder"):
it = self.append(parent)
for pane in range(self.ntree):
column = self.column_index(COL_PATH, pane)
self.unsafe_set(it, {column: None})
self.set_state(it, pane, STATE_EMPTY, text)
return it
def add_error(self, parent, msg, pane):
it = self.append(parent)
for i in range(self.ntree):
column = self.column_index(COL_STATE, i)
self.unsafe_set(it, {column: str(STATE_ERROR)})
self.unsafe_set(it, i, {COL_STATE: str(STATE_ERROR)})
self.set_state(it, pane, STATE_ERROR, msg)
def set_path_state(self, it, pane, state, isdir=0, display_text=None):
......@@ -155,19 +151,18 @@ class DiffTreeStore(SearchableTreeStore):
self.set_state(it, pane, state, display_text, isdir)
def set_state(self, it, pane, state, label, isdir=0):
col_idx = self.column_index
icon = self.icon_details[state][1 if isdir else 0]
tint = self.icon_details[state][3 if isdir else 2]
fg, style, weight, strike = self.text_attributes[state]
self.unsafe_set(it, {
col_idx(COL_STATE, pane): str(state),
col_idx(COL_TEXT, pane): label,
col_idx(COL_ICON, pane): icon,
col_idx(COL_TINT, pane): tint,
col_idx(COL_FG, pane): fg,
col_idx(COL_STYLE, pane): style,
col_idx(COL_WEIGHT, pane): weight,
col_idx(COL_STRIKE, pane): strike,
self.unsafe_set(it, pane, {
COL_STATE: str(state),
COL_TEXT: label,
COL_ICON: icon,
COL_TINT: tint,
COL_FG: fg,
COL_STYLE: style,
COL_WEIGHT: weight,
COL_STRIKE: strike
def get_state(self, it, pane):
......@@ -195,7 +190,7 @@ class DiffTreeStore(SearchableTreeStore):
if state in states:
yield it
def unsafe_set(self, treeiter, keys_values):
def unsafe_set(self, treeiter, pane, keys_values):
""" This must be fastest than super.set,
at the cost that may crash the application if you don't
know what your're passing here.
......@@ -209,7 +204,9 @@ class DiffTreeStore(SearchableTreeStore):
return None
safe_keys_values = {
col: val if val is not None else self._none_of_cols.get(col)
self.column_index(col, pane):
val if val is not None
else self._none_of_cols.get(self.column_index(col, pane))
for col, val in keys_values.items()
if _GIGtk and treeiter:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment