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
1=== modified file 'stk/supertree_toolkit.py'
2--- stk/supertree_toolkit.py 2014-10-10 09:23:22 +0000
3+++ stk/supertree_toolkit.py 2014-10-30 11:42:05 +0000
4@@ -226,8 +226,11 @@
5 for t in source.xpath("source_tree"):
6 if 'name' in t.attrib and not t.attrib['name'] == "":
7 tree_count += 1
8-
9- tree_name = source.attrib['name'] + "_" + str(tree_count)
10+ try:
11+ tree_name = source.attrib['name'] + "_" + str(tree_count)
12+ except KeyError:
13+ # no name set for source
14+ tree_name = str(tree_count)
15
16 return tree_name
17
18
19=== modified file 'stk_gui/gui/gui.glade'
20--- stk_gui/gui/gui.glade 2014-10-09 09:33:21 +0000
21+++ stk_gui/gui/gui.glade 2014-10-30 11:42:05 +0000
22@@ -1338,7 +1338,23 @@
23 <property name="fill">True</property>
24 <property name="position">2</property>
25 </packing>
26- </child>
27+ </child>
28+ <child>
29+ <widget class="GtkCheckButton" id="ignoreWarnings_checkbutton">
30+ <property name="label" translatable="yes">Ignore Warnings</property>
31+ <property name="visible">True</property>
32+ <property name="can_focus">True</property>
33+ <property name="receives_default">False</property>
34+ <property name="use_action_appearance">False</property>
35+ <property name="draw_indicator">True</property>
36+ </widget>
37+ <packing>
38+ <property name="expand">True</property>
39+ <property name="fill">True</property>
40+ <property name="position">2</property>
41+ </packing>
42+
43+ </child>
44 </widget>
45 </child>
46 </widget>
47
48=== modified file 'stk_gui/plugins/phyml/import_tree.py'
49--- stk_gui/plugins/phyml/import_tree.py 2014-10-07 12:07:38 +0000
50+++ stk_gui/plugins/phyml/import_tree.py 2014-10-30 11:42:05 +0000
51@@ -39,8 +39,12 @@
52 except TreeParseError as detail:
53 msg = "Failed to import tree - can't parse tree.\n"+detail.msg
54 dialogs.error(self.main_window,msg)
55- tree_name = stk.create_tree_name(xml,element.get_parent().get_parent())
56+ source_tree_ele = element[0].getparent().getparent().getparent()
57+ tree_name = stk.create_tree_name(xml,source_tree_ele)
58+ print tree_name
59 element[0].text = tree
60+ source_tree_ele.attrib['name'] = tree_name
61+
62
63 stk_gui.interface.plugin_xml = etree.tostring(xml_root)
64 stk_gui.interface.pluginSender.emit('plugin_changed_xml')
65
66=== modified file 'stk_gui/stk_gui/interface.py'
67--- stk_gui/stk_gui/interface.py 2014-10-13 07:47:23 +0000
68+++ stk_gui/stk_gui/interface.py 2014-10-30 11:42:05 +0000
69@@ -1951,9 +1951,9 @@
70 ignoreWarnings = self.export_trees_gui.get_widget("ignoreWarnings_checkbutton").get_active()
71
72 if (format_radio_1.get_active()):
73- format = 'Nexus'
74+ format = 'nexus'
75 elif (format_radio_2.get_active()):
76- format = 'Newick'
77+ format = 'newick'
78 elif (format_radio_3.get_active()):
79 format = 'tnt'
80 else:
81@@ -1969,7 +1969,7 @@
82 self.tree.write(f)
83 XML = f.getvalue()
84 try:
85- self.output_string = stk.amalgamate_trees(XML,format=format,anonymous=anonymous,ignoreWarnings=ignoreWarnings)
86+ output_string = stk.amalgamate_trees(XML,format=format,anonymous=anonymous,ignoreWarnings=False)
87 except NotUniqueError as detail:
88 msg = "Failed to export trees.\n"+detail.msg
89 dialogs.error(self.main_window,msg)
90@@ -1987,7 +1987,8 @@
91 dialogs.error(self.main_window,msg)
92 return
93 except:
94- msg = "Failed to export trees due to an unknown error. Check the console output"
95+ msg = "Failed to export trees due to an unknown error. Please report this a bug"
96+ msg += "\n" + traceback.format_exc()
97 dialogs.error(self.main_window,msg)
98 return
99
100@@ -1996,8 +1997,10 @@
101 # open file dialog
102 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)
103
104+ if (filename == None):
105+ return # user cancelled save
106 f = open(filename,"w")
107- f.write(self.output_string)
108+ f.write(output_string)
109 f.close()
110
111 XML = stk.add_historical_event(XML, "Tree exported to: "+filename)
112@@ -2107,6 +2110,7 @@
113 return
114 except:
115 msg = "Failed to parse XML and obtain taxa. You probably have an unfinished dataset"
116+ msg += "\n" + traceback.format_exc()
117 dialogs.error(self.main_window,msg)
118 return
119
120@@ -2307,7 +2311,8 @@
121 dialogs.error(self.main_window,msg)
122 return
123 except:
124- msg = "Failed to substitute taxa due to an unknown error. Check the console output"
125+ msg = "Failed to substitute taxa due to an unknown error. Possibly a bug. PLease report on Launchpad."
126+ msg += "\n" + traceback.format_exc()
127 dialogs.error(self.main_window,msg)
128 return
129
130@@ -2445,8 +2450,8 @@
131 dialogs.error(self.main_window,msg)
132 return
133 except:
134- msg = "Failed to clean data due to an unknown error. Check the console output"
135- traceback.print_exc()
136+ msg = "Failed to clean data due to an unknown error. Possibly a bug. Please report on Launchpad"
137+ msg += "\n" + traceback.format_exc()
138 dialogs.error(self.main_window,msg)
139 return
140
141@@ -2510,8 +2515,8 @@
142 dialogs.error(self.main_window,msg)
143 return
144 except:
145- msg = "Failed to replace generic taxa due to an unknown error. Check the console output"
146- traceback.print_exc()
147+ msg = "Failed to replace generic taxa due to an unknown error. Possibly a bug. Please report on Launchpad"
148+ msg += "\n" + traceback.format_exc()
149 dialogs.error(self.main_window,msg)
150 return
151
152@@ -2722,8 +2727,8 @@
153 dialogs.error(self.main_window,msg)
154 return
155 except:
156- msg = "Failed to create subset due to an unknown error. Check the console output"
157- traceback.print_exc()
158+ msg = "Failed to create subset due to an unknown error. Possibly a bug. Please report on Launchpad"
159+ msg += "\n" + traceback.format_exc()
160 dialogs.error(self.main_window,msg)
161 return
162
163@@ -2768,7 +2773,8 @@
164 dialogs.error(self.main_window,msg)
165 return
166 except:
167- msg = "Failed to name trees due to an unknown error. Check the console output"
168+ msg = "Failed to name trees due to an unknown error. Possibly a bug. Please report on Launchpad"
169+ msg += "\n" + traceback.format_exc()
170 dialogs.error(self.main_window,msg)
171 return
172

Subscribers

People subscribed via source and target branches

to all changes: