Merge lp:~jon-hill/supertree-toolkit/bug_fixes into lp:supertree-toolkit

Proposed by Jon Hill
Status: Merged
Merged at revision: 255
Proposed branch: lp:~jon-hill/supertree-toolkit/bug_fixes
Merge into: lp:supertree-toolkit
Diff against target: 171 lines (+46/-17)
4 files modified
stk/supertree_toolkit.py (+5/-2)
stk_gui/gui/gui.glade (+17/-1)
stk_gui/plugins/phyml/import_tree.py (+5/-1)
stk_gui/stk_gui/interface.py (+19/-13)
To merge this branch: bzr merge lp:~jon-hill/supertree-toolkit/bug_fixes
Reviewer Review Type Date Requested Status
Jon Hill Approve
Review via email: mp+240105@code.launchpad.net

Description of the change

Fixed 1387604 and 1387603

To post a comment you must log in.
Revision history for this message
Jon Hill (jon-hill) :
review: Approve
255. By Jon Hill

Fixes to export_trees and import_trees

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stk/supertree_toolkit.py'
--- stk/supertree_toolkit.py 2014-10-10 09:23:22 +0000
+++ stk/supertree_toolkit.py 2014-10-30 11:42:05 +0000
@@ -226,8 +226,11 @@
226 for t in source.xpath("source_tree"):226 for t in source.xpath("source_tree"):
227 if 'name' in t.attrib and not t.attrib['name'] == "":227 if 'name' in t.attrib and not t.attrib['name'] == "":
228 tree_count += 1228 tree_count += 1
229229 try:
230 tree_name = source.attrib['name'] + "_" + str(tree_count)230 tree_name = source.attrib['name'] + "_" + str(tree_count)
231 except KeyError:
232 # no name set for source
233 tree_name = str(tree_count)
231234
232 return tree_name235 return tree_name
233236
234237
=== modified file 'stk_gui/gui/gui.glade'
--- stk_gui/gui/gui.glade 2014-10-09 09:33:21 +0000
+++ stk_gui/gui/gui.glade 2014-10-30 11:42:05 +0000
@@ -1338,7 +1338,23 @@
1338 <property name="fill">True</property>1338 <property name="fill">True</property>
1339 <property name="position">2</property>1339 <property name="position">2</property>
1340 </packing>1340 </packing>
1341 </child>1341 </child>
1342 <child>
1343 <widget class="GtkCheckButton" id="ignoreWarnings_checkbutton">
1344 <property name="label" translatable="yes">Ignore Warnings</property>
1345 <property name="visible">True</property>
1346 <property name="can_focus">True</property>
1347 <property name="receives_default">False</property>
1348 <property name="use_action_appearance">False</property>
1349 <property name="draw_indicator">True</property>
1350 </widget>
1351 <packing>
1352 <property name="expand">True</property>
1353 <property name="fill">True</property>
1354 <property name="position">2</property>
1355 </packing>
1356
1357 </child>
1342 </widget>1358 </widget>
1343 </child>1359 </child>
1344 </widget>1360 </widget>
13451361
=== modified file 'stk_gui/plugins/phyml/import_tree.py'
--- stk_gui/plugins/phyml/import_tree.py 2014-10-07 12:07:38 +0000
+++ stk_gui/plugins/phyml/import_tree.py 2014-10-30 11:42:05 +0000
@@ -39,8 +39,12 @@
39 except TreeParseError as detail:39 except TreeParseError as detail:
40 msg = "Failed to import tree - can't parse tree.\n"+detail.msg40 msg = "Failed to import tree - can't parse tree.\n"+detail.msg
41 dialogs.error(self.main_window,msg)41 dialogs.error(self.main_window,msg)
42 tree_name = stk.create_tree_name(xml,element.get_parent().get_parent())42 source_tree_ele = element[0].getparent().getparent().getparent()
43 tree_name = stk.create_tree_name(xml,source_tree_ele)
44 print tree_name
43 element[0].text = tree45 element[0].text = tree
46 source_tree_ele.attrib['name'] = tree_name
47
44 48
45 stk_gui.interface.plugin_xml = etree.tostring(xml_root)49 stk_gui.interface.plugin_xml = etree.tostring(xml_root)
46 stk_gui.interface.pluginSender.emit('plugin_changed_xml')50 stk_gui.interface.pluginSender.emit('plugin_changed_xml')
4751
=== modified file 'stk_gui/stk_gui/interface.py'
--- stk_gui/stk_gui/interface.py 2014-10-13 07:47:23 +0000
+++ stk_gui/stk_gui/interface.py 2014-10-30 11:42:05 +0000
@@ -1951,9 +1951,9 @@
1951 ignoreWarnings = self.export_trees_gui.get_widget("ignoreWarnings_checkbutton").get_active()1951 ignoreWarnings = self.export_trees_gui.get_widget("ignoreWarnings_checkbutton").get_active()
19521952
1953 if (format_radio_1.get_active()):1953 if (format_radio_1.get_active()):
1954 format = 'Nexus'1954 format = 'nexus'
1955 elif (format_radio_2.get_active()):1955 elif (format_radio_2.get_active()):
1956 format = 'Newick'1956 format = 'newick'
1957 elif (format_radio_3.get_active()):1957 elif (format_radio_3.get_active()):
1958 format = 'tnt'1958 format = 'tnt'
1959 else:1959 else:
@@ -1969,7 +1969,7 @@
1969 self.tree.write(f)1969 self.tree.write(f)
1970 XML = f.getvalue()1970 XML = f.getvalue()
1971 try:1971 try:
1972 self.output_string = stk.amalgamate_trees(XML,format=format,anonymous=anonymous,ignoreWarnings=ignoreWarnings)1972 output_string = stk.amalgamate_trees(XML,format=format,anonymous=anonymous,ignoreWarnings=False)
1973 except NotUniqueError as detail:1973 except NotUniqueError as detail:
1974 msg = "Failed to export trees.\n"+detail.msg1974 msg = "Failed to export trees.\n"+detail.msg
1975 dialogs.error(self.main_window,msg)1975 dialogs.error(self.main_window,msg)
@@ -1987,7 +1987,8 @@
1987 dialogs.error(self.main_window,msg)1987 dialogs.error(self.main_window,msg)
1988 return 1988 return
1989 except:1989 except:
1990 msg = "Failed to export trees due to an unknown error. Check the console output"1990 msg = "Failed to export trees due to an unknown error. Please report this a bug"
1991 msg += "\n" + traceback.format_exc()
1991 dialogs.error(self.main_window,msg)1992 dialogs.error(self.main_window,msg)
1992 return 1993 return
19931994
@@ -1996,8 +1997,10 @@
1996 # open file dialog1997 # open file dialog
1997 filename = dialogs.get_filename(title = "Choose output trees fle", action = gtk.FILE_CHOOSER_ACTION_SAVE, filter_names_and_patterns = filter_names_and_patterns, folder_uri = self.file_path)1998 filename = dialogs.get_filename(title = "Choose output trees fle", action = gtk.FILE_CHOOSER_ACTION_SAVE, filter_names_and_patterns = filter_names_and_patterns, folder_uri = self.file_path)
19981999
2000 if (filename == None):
2001 return # user cancelled save
1999 f = open(filename,"w")2002 f = open(filename,"w")
2000 f.write(self.output_string)2003 f.write(output_string)
2001 f.close()2004 f.close()
20022005
2003 XML = stk.add_historical_event(XML, "Tree exported to: "+filename)2006 XML = stk.add_historical_event(XML, "Tree exported to: "+filename)
@@ -2107,6 +2110,7 @@
2107 return2110 return
2108 except:2111 except:
2109 msg = "Failed to parse XML and obtain taxa. You probably have an unfinished dataset"2112 msg = "Failed to parse XML and obtain taxa. You probably have an unfinished dataset"
2113 msg += "\n" + traceback.format_exc()
2110 dialogs.error(self.main_window,msg)2114 dialogs.error(self.main_window,msg)
2111 return 2115 return
21122116
@@ -2307,7 +2311,8 @@
2307 dialogs.error(self.main_window,msg)2311 dialogs.error(self.main_window,msg)
2308 return 2312 return
2309 except:2313 except:
2310 msg = "Failed to substitute taxa due to an unknown error. Check the console output"2314 msg = "Failed to substitute taxa due to an unknown error. Possibly a bug. PLease report on Launchpad."
2315 msg += "\n" + traceback.format_exc()
2311 dialogs.error(self.main_window,msg)2316 dialogs.error(self.main_window,msg)
2312 return 2317 return
23132318
@@ -2445,8 +2450,8 @@
2445 dialogs.error(self.main_window,msg)2450 dialogs.error(self.main_window,msg)
2446 return 2451 return
2447 except:2452 except:
2448 msg = "Failed to clean data due to an unknown error. Check the console output"2453 msg = "Failed to clean data due to an unknown error. Possibly a bug. Please report on Launchpad"
2449 traceback.print_exc() 2454 msg += "\n" + traceback.format_exc()
2450 dialogs.error(self.main_window,msg)2455 dialogs.error(self.main_window,msg)
2451 return 2456 return
24522457
@@ -2510,8 +2515,8 @@
2510 dialogs.error(self.main_window,msg)2515 dialogs.error(self.main_window,msg)
2511 return 2516 return
2512 except:2517 except:
2513 msg = "Failed to replace generic taxa due to an unknown error. Check the console output"2518 msg = "Failed to replace generic taxa due to an unknown error. Possibly a bug. Please report on Launchpad"
2514 traceback.print_exc() 2519 msg += "\n" + traceback.format_exc()
2515 dialogs.error(self.main_window,msg)2520 dialogs.error(self.main_window,msg)
2516 return 2521 return
25172522
@@ -2722,8 +2727,8 @@
2722 dialogs.error(self.main_window,msg)2727 dialogs.error(self.main_window,msg)
2723 return 2728 return
2724 except:2729 except:
2725 msg = "Failed to create subset due to an unknown error. Check the console output"2730 msg = "Failed to create subset due to an unknown error. Possibly a bug. Please report on Launchpad"
2726 traceback.print_exc() 2731 msg += "\n" + traceback.format_exc()
2727 dialogs.error(self.main_window,msg)2732 dialogs.error(self.main_window,msg)
2728 return 2733 return
2729 2734
@@ -2768,7 +2773,8 @@
2768 dialogs.error(self.main_window,msg)2773 dialogs.error(self.main_window,msg)
2769 return 2774 return
2770 except:2775 except:
2771 msg = "Failed to name trees due to an unknown error. Check the console output"2776 msg = "Failed to name trees due to an unknown error. Possibly a bug. Please report on Launchpad"
2777 msg += "\n" + traceback.format_exc()
2772 dialogs.error(self.main_window,msg)2778 dialogs.error(self.main_window,msg)
2773 return 2779 return
2774 2780

Subscribers

People subscribed via source and target branches

to all changes: