|
@@ -80,7 +80,7 @@ def to_named_value(name: str) -> Callable[[str], Tuple[str,str]]:
|
|
|
|
|
|
def blank_tags_row(idx: int) -> Tuple[AutoCompleteEdit, Edit]:
|
|
|
return (
|
|
|
- AutoCompleteEdit(('bg', f'tags#{idx}')), Edit(('bg', f'descriptions#{idx}')),
|
|
|
+ AutoCompleteEdit(('bg',f'tags#{idx}')), Edit(('bg', f'')),
|
|
|
)
|
|
|
|
|
|
|
|
@@ -123,8 +123,6 @@ class TransactionEditor(FocusWidget):
|
|
|
lambda x: x[0] not in ('tags','description'),
|
|
|
map(lambda x: (x[0][0], x[1]), data.items())
|
|
|
))
|
|
|
- print(_data)
|
|
|
- input()
|
|
|
options = self.query_manager.unique_suggestions(k[0], **_data)
|
|
|
|
|
|
if len(options) == 1 and k != 'ts':
|
|
@@ -156,14 +154,17 @@ class TransactionEditor(FocusWidget):
|
|
|
@data.setter
|
|
|
def data(self, _data: dict):
|
|
|
for k,v in _data.items():
|
|
|
+ _name = to_unnumbered_field(to_numbered_field((k,None)))
|
|
|
+ if _name[0] not in [
|
|
|
+ 'tags', 'descriptions'
|
|
|
+ ]:
|
|
|
+ k = _name[0]
|
|
|
if k in self.edit_fields and v != self.edit_fields[k].get_edit_text():
|
|
|
self.edit_fields[k].set_edit_text(v)
|
|
|
- if k in self.checkboxes and v != self.checkboxes[k].state:
|
|
|
+ elif k in self.checkboxes and v != self.checkboxes[k].state:
|
|
|
self.checkboxes[k].set_state(v)
|
|
|
- if len(k.split('#')) > 1:
|
|
|
+ elif len(k.split('#')) > 1:
|
|
|
name, idx = k.split('#', 1)
|
|
|
- if name not in ['tags', 'descriptions']:
|
|
|
- continue
|
|
|
w = self._tags[int(idx)][ next(( pos for pos, n in zip(
|
|
|
[0, 1],
|
|
|
['tags', 'descriptions']
|
|
@@ -172,15 +173,16 @@ class TransactionEditor(FocusWidget):
|
|
|
|
|
|
|
|
|
def init_tags(self):
|
|
|
- _tags = LineBox(Pile([tag[0] for tag in self._tags]),
|
|
|
- #AutoCompletePopUp(
|
|
|
- # tag[0],
|
|
|
- # self.apply_choice,
|
|
|
- # lambda: self.activity_manager.show(self.update())
|
|
|
- #), 'streak') for tag in self._tags]),
|
|
|
- title='Tags',
|
|
|
- title_align='left'
|
|
|
- )
|
|
|
+ #_tags = LineBox(Pile([AttrMap(
|
|
|
+ _tags = Pile([AttrMap(
|
|
|
+ AutoCompletePopUp(
|
|
|
+ tag[0],
|
|
|
+ self.apply_choice,
|
|
|
+ lambda: self.activity_manager.show(self.update())
|
|
|
+ ), 'streak') for tag in self._tags])
|
|
|
+ # title=f'Tags',
|
|
|
+ # title_align='left'
|
|
|
+ #)
|
|
|
gutter = Pile([
|
|
|
*[ Divider() for _ in itertools.product(
|
|
|
range(1), self._tags[:-1]
|
|
@@ -197,7 +199,8 @@ class TransactionEditor(FocusWidget):
|
|
|
blank_tags_row(len(self._tags))
|
|
|
)
|
|
|
_tags, gutter = self.init_tags()
|
|
|
- self.components['tags'].original_widget.contents = list(_tags.original_widget.contents)
|
|
|
+ #self.components['tags'][1].original_widget.contents = list(_tags.original_widget.contents)
|
|
|
+ self.components['tags'].contents = list(_tags.contents)
|
|
|
self.components['gutter'][1].contents = list(gutter.contents)
|
|
|
for idx, widget in enumerate(self._tags):
|
|
|
connect_signal(widget[0], 'postchange', lambda w,_: self.update())
|
|
@@ -356,7 +359,7 @@ class TransactionEditor(FocusWidget):
|
|
|
_tags, gutter = self.init_tags()
|
|
|
self.components = {
|
|
|
'tags': _tags,
|
|
|
- 'gutter': gutter,
|
|
|
+ 'gutter': (8,gutter),
|
|
|
}
|
|
|
self.edit_fields = {
|
|
|
'ts': AutoCompleteEdit(('bg', 'ts')),
|
|
@@ -408,7 +411,7 @@ class TransactionEditor(FocusWidget):
|
|
|
'spread',
|
|
|
'marker',
|
|
|
]
|
|
|
- self.clear()
|
|
|
+ #self.clear()
|
|
|
_widgets = dict(itertools.chain(*[
|
|
|
[(k, v) for k,v in x] for x in map(lambda x: x.items(), [
|
|
|
self.edit_fields, self.text_fields, self.checkboxes
|
|
@@ -460,10 +463,6 @@ class TransactionEditor(FocusWidget):
|
|
|
lambda x: _widgets[x] if x is not None else Divider(),
|
|
|
bottom_pane
|
|
|
)),
|
|
|
- #(17, Columns([
|
|
|
- #(10,self.components['tags']),
|
|
|
- #(7,self.components['gutter']),
|
|
|
- #])),
|
|
|
(self.graph.total_width+2, Pile([
|
|
|
LineBox(
|
|
|
AttrMap(self.components['badge'], 'badge'),
|
|
@@ -512,6 +511,7 @@ class TransactionEditor(FocusWidget):
|
|
|
self.components['main_pane'].append(Columns(col))
|
|
|
|
|
|
self.components['main_pane'] = Pile(self.components['main_pane'])
|
|
|
+ self.add_tag()
|
|
|
|
|
|
widget = Pile([
|
|
|
banner,
|
|
@@ -519,8 +519,12 @@ class TransactionEditor(FocusWidget):
|
|
|
Columns([
|
|
|
self.components['main_pane'],
|
|
|
self.components['side_pane'],
|
|
|
- (12,self.components['tags']),
|
|
|
- (8,self.components['gutter']),
|
|
|
+ (12,LineBox(
|
|
|
+ self.components['tags'],
|
|
|
+ title=f'Tags',
|
|
|
+ title_align='left'
|
|
|
+ )),
|
|
|
+ self.components['gutter'],
|
|
|
], dividechars=2),
|
|
|
self.components['bottom_pane'],
|
|
|
Divider(),
|