Skip to content

Commit

Permalink
multiple s(Q) processing and bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvieta1990 committed Dec 15, 2022
1 parent ffe15c1 commit 58ad8b6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
32 changes: 19 additions & 13 deletions addie/calculate_gr/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,26 @@ def generate_gr_step1(main_window):
:return:
"""
# get S(Q) workspace
comboBox_SofQ = main_window.calculategr_ui.comboBox_SofQ
selected_sq = str(comboBox_SofQ.currentText())
if selected_sq == 'All':
sq_ws_name_list = list()
for index in range(comboBox_SofQ.count()):
item = str(comboBox_SofQ.itemText(index))
if item != 'All':
# add S(Q) name unless it is 'All'
sq_ws_name_list.append(item)
# END-IF
# END-FOR
gr_list = main_window.calculategr_ui.treeWidget_grWsList
sq_name_list = gr_list.get_selected_items_of_level(
2, excluded_parent='GofR', return_item_text=True)
if len(sq_name_list) == 0:
comboBox_SofQ = main_window.calculategr_ui.comboBox_SofQ
selected_sq = str(comboBox_SofQ.currentText())
if selected_sq == 'All':
sq_ws_name_list = list()
for index in range(comboBox_SofQ.count()):
item = str(comboBox_SofQ.itemText(index))
if item != 'All':
# add S(Q) name unless it is 'All'
sq_ws_name_list.append(item)
# END-IF
# END-FOR
else:
# selected S(Q) is a single S(Q) name
sq_ws_name_list = [selected_sq]
else:
# selected S(Q) is a single S(Q) name
sq_ws_name_list = [selected_sq]
sq_ws_name_list = sq_name_list

# generate G(r)
generate_gr_step2(main_window,
Expand Down
9 changes: 7 additions & 2 deletions addie/calculate_gr/gofrtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,11 @@ def do_delete_selected_items(self):
if curr_level == -1:
curr_level = temp_level
elif curr_level != temp_level:
raise RuntimeError(
'Nodes of different levels are selected. It is not supported for deletion.')
err_msg = "Nodes of different levels are selected."
self.parent.ui.statusbar.setStyleSheet("color: red")
self.parent.ui.statusbar.showMessage(err_msg,
self.parent.statusbar_display_time)
return

# get item and delete
if curr_level == 0:
Expand Down Expand Up @@ -316,6 +319,8 @@ def _delete_ws_node(self, ws_item, is_gr, check_gr_sq):
print('Unable to remove %s from canvas due to %s.' %
(leaf_node_name, str(ass_err)))
# delete node
item_tmp = self.parent.calculategr_ui.comboBox_SofQ.findText(ws_item.text())
self.parent.calculategr_ui.comboBox_SofQ.removeItem(item_tmp)
self.delete_node(ws_item)

def do_plot(self):
Expand Down

0 comments on commit 58ad8b6

Please sign in to comment.