Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reassign Parent for Keynote #1921

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def __init__(self,
self.recordKeyTitle.Text = self.get_locale_string("EditKeynoteKey")
self.applyChanges.Content = self.get_locale_string("EditKeynoteApply")
self.recordKey.IsEnabled = False
#allow changing Parent key
self.recordParent.IsEnabled = True
if self._rkeynote:
# start edit
if self._rkeynote.key:
Expand Down Expand Up @@ -261,13 +263,28 @@ def pick_key(self, sender, args):
self.active_key = new_key

def pick_parent(self, sender, args):
# TODO: pick_parent
# categories = get_categories(self._conn)
# keynotes_tree = get_keynotes_tree(self._conn)
forms.alert(self.get_locale_string("PickParent"))
categories = kdb.get_categories(self._conn)
keynotes = kdb.get_keynotes(self._conn)
available_parents = [x.key for x in categories]
available_parents.extend([x.key for x in keynotes])
# remove self from that record if self is not none
if self.active_key in available_parents:
available_parents.remove(self.active_key)
# prompt to select a record
# apply the record key on the button
new_parent = forms.SelectFromList.show(
available_parents,
title='Select Parent',
multiselect=False
)
if new_parent:
try:
kdb.reserve_key(self._conn, self.active_key, category=self._cat)
except System.TimeoutException as toutex:
forms.alert(toutex.Message)
return
self._reserved_key = self.active_key
# apply the record key on the button
self.active_parent_key = new_parent

def to_upper(self, sender, args):
self.active_text = self.active_text.upper()
Expand Down