Skip to content

Commit

Permalink
Re #4303 Fixed ui issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Jan 25, 2012
1 parent 5b7a8da commit 187b48c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 32 deletions.
18 changes: 0 additions & 18 deletions Code/Mantid/scripts/Interface/reduction_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,6 @@ def __init__(self, instrument=None, instrument_list=None):
# Flag to let use know that we need to close the window as soon as possible
self._quit_asap = False

# There is an edge-case where the user doesn't have a facility/instrument
# selected and hits cancel when the instrument selection dialog shows up.
# In that case, the main window is shown empty and it should be closed.
# Since the close() method can only be called after the QApplication has been
# started, we use the _quit_asap flag to close it as soon as we can.
# Note that we choose to show the dialog before showing the main window because
# we don't want to have the main window appear empty in the main use-case.
class ShowEventFilter(QtCore.QObject):
def eventFilter(obj_self, filteredObj, event):
if event.type() == QtCore.QEvent.ActivationChange\
and filteredObj.isActiveWindow()\
and self._quit_asap:
self.close()
return QtCore.QObject.eventFilter(obj_self, filteredObj, event)

eventFilter = ShowEventFilter(self)
self.installEventFilter(eventFilter)

def _set_window_title(self):
"""
Sets the window title using the instrument name and the
Expand Down
37 changes: 30 additions & 7 deletions Code/Mantid/scripts/Interface/ui/reduction_main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,34 @@
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Tab 1</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 2</string>
<string>No Instrument Selected</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;No instrument was selected!&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;You need to select an instrument from the Tools menu&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; or the Instrument Dialog to continue.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="interface_chk">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Advanced interface</string>
</property>
Expand All @@ -72,7 +86,7 @@
<item>
<widget class="QProgressBar" name="progress_bar">
<property name="value">
<number>24</number>
<number>0</number>
</property>
</widget>
</item>
Expand All @@ -94,6 +108,9 @@
</item>
<item>
<widget class="QPushButton" name="reduce_button">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Click to execute reduction.</string>
</property>
Expand All @@ -104,6 +121,9 @@
</item>
<item>
<widget class="QPushButton" name="save_button">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Click to save your reduction parameters.</string>
</property>
Expand All @@ -114,6 +134,9 @@
</item>
<item>
<widget class="QPushButton" name="export_button">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Click to export the reduction parameters to a python script that can be run in MantidPlot.</string>
</property>
Expand Down
27 changes: 20 additions & 7 deletions Code/Mantid/scripts/Interface/ui/ui_reduction_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'ui/reduction_main.ui'
#
# Created: Wed Nov 16 13:57:36 2011
# Created: Wed Jan 25 09:40:15 2012
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -32,31 +32,37 @@ def setupUi(self, SANSReduction):
self.tabWidget.setObjectName("tabWidget")
self.tab = QtGui.QWidget()
self.tab.setObjectName("tab")
self.verticalLayout_2 = QtGui.QVBoxLayout(self.tab)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label = QtGui.QLabel(self.tab)
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.label)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QtGui.QWidget()
self.tab_2.setObjectName("tab_2")
self.tabWidget.addTab(self.tab_2, "")
self.verticalLayout.addWidget(self.tabWidget)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.interface_chk = QtGui.QCheckBox(self.centralwidget)
self.interface_chk.setEnabled(True)
self.interface_chk.setObjectName("interface_chk")
self.horizontalLayout.addWidget(self.interface_chk)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.progress_bar = QtGui.QProgressBar(self.centralwidget)
self.progress_bar.setProperty("value", 24)
self.progress_bar.setProperty("value", 0)
self.progress_bar.setObjectName("progress_bar")
self.horizontalLayout.addWidget(self.progress_bar)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.reduce_button = QtGui.QPushButton(self.centralwidget)
self.reduce_button.setEnabled(False)
self.reduce_button.setObjectName("reduce_button")
self.horizontalLayout.addWidget(self.reduce_button)
self.save_button = QtGui.QPushButton(self.centralwidget)
self.save_button.setEnabled(False)
self.save_button.setObjectName("save_button")
self.horizontalLayout.addWidget(self.save_button)
self.export_button = QtGui.QPushButton(self.centralwidget)
self.export_button.setEnabled(False)
self.export_button.setObjectName("export_button")
self.horizontalLayout.addWidget(self.export_button)
self.verticalLayout.addLayout(self.horizontalLayout)
Expand Down Expand Up @@ -87,8 +93,15 @@ def setupUi(self, SANSReduction):

def retranslateUi(self, SANSReduction):
SANSReduction.setWindowTitle(QtGui.QApplication.translate("SANSReduction", "SANS Reduction", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("SANSReduction", "Tab 1", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("SANSReduction", "Tab 2", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("SANSReduction", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">No instrument was selected!</span></p>\n"
"<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">You need to select an instrument from the Tools menu</span></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\"> or the Instrument Dialog to continue.</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("SANSReduction", "No Instrument Selected", None, QtGui.QApplication.UnicodeUTF8))
self.interface_chk.setText(QtGui.QApplication.translate("SANSReduction", "Advanced interface", None, QtGui.QApplication.UnicodeUTF8))
self.reduce_button.setToolTip(QtGui.QApplication.translate("SANSReduction", "Click to execute reduction.", None, QtGui.QApplication.UnicodeUTF8))
self.reduce_button.setText(QtGui.QApplication.translate("SANSReduction", "Reduce", None, QtGui.QApplication.UnicodeUTF8))
Expand Down

0 comments on commit 187b48c

Please sign in to comment.