ChooseAnalysis: Fix Ok button.

Also move double-click signal connection to .ui.
This commit is contained in:
Chris PeBenito 2016-04-20 09:55:10 -04:00
parent f6cecd407f
commit a22fc0f669
2 changed files with 37 additions and 4 deletions

View File

@ -75,5 +75,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ChooseAnalysis</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>400</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>210</y>
</hint>
</hints>
</connection>
<connection>
<sender>analysisTypes</sender>
<signal>itemDoubleClicked(QTreeWidgetItem*,int)</signal>
<receiver>ChooseAnalysis</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>206</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>210</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -66,7 +66,6 @@ class ChooseAnalysis(SEToolsWidget, QDialog):
def setupUi(self):
self.load_ui("choose_analysis.ui")
self.analysisTypes.doubleClicked.connect(self.accept)
def show(self, mls):
analysis_map = {"Domain Transition Analysis": DomainTransitionAnalysisTab,
@ -118,10 +117,12 @@ class ChooseAnalysis(SEToolsWidget, QDialog):
self.analysisTypes.sortByColumn(0, Qt.AscendingOrder)
super(ChooseAnalysis, self).show()
def accept(self):
def accept(self, item=None):
try:
# .ui is set for single item selection.
item = self.analysisTypes.selectedItems()[0]
if not item:
# .ui is set for single item selection.
item = self.analysisTypes.selectedItems()[0]
title = item.text(0)
self.parent.create_new_analysis(title, item._tab_class)
except (IndexError, TypeError):