Skip to content

Commit

Permalink
Merge pull request #1636 from astrofrog/improve-export
Browse files Browse the repository at this point in the history
Improve UI for saving/exporting data
  • Loading branch information
astrofrog committed Apr 1, 2018
2 parents 95171e7 + 559c793 commit 5e2a568
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 61 deletions.
14 changes: 10 additions & 4 deletions glue/app/qt/application.py
Expand Up @@ -311,7 +311,7 @@ def _setup_ui(self):
self._data_toolbar.addWidget(self._button_open_data)

self._button_save_data = QtWidgets.QToolButton()
self._button_save_data.setText("Save Data")
self._button_save_data.setText("Export Data/Subsets")
self._button_save_data.setIcon(get_icon('glue_filesave'))
self._button_save_data.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self._button_save_data.clicked.connect(nonpartial(self._choose_save_data))
Expand Down Expand Up @@ -345,7 +345,7 @@ def _setup_ui(self):
self._data_toolbar.addWidget(self._button_open_session)

self._button_save_session = QtWidgets.QToolButton()
self._button_save_session.setText("Save Session")
self._button_save_session.setText("Export Session")
self._button_save_session.setIcon(get_icon('glue_filesave'))
self._button_save_session.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self._button_save_session.clicked.connect(nonpartial(self._choose_save_session))
Expand Down Expand Up @@ -662,8 +662,9 @@ def _create_menu(self):
menu.addAction(self._actions['session_reset'])
menu.addAction(self._actions['session_restore'])
menu.addAction(self._actions['session_save'])
menu.addAction(self._actions['export_data'])
if 'session_export' in self._actions:
submenu = menu.addMenu("E&xport")
submenu = menu.addMenu("Advanced E&xporters")
for a in self._actions['session_export']:
submenu.addAction(a)
menu.addSeparator()
Expand Down Expand Up @@ -794,7 +795,7 @@ def _create_actions(self):
a.triggered.connect(nonpartial(self.gather_current_tab))
self._actions['gather'] = a

a = action('&Save Session', self,
a = action('&Export Session', self,
tip='Save the current session')
a.triggered.connect(nonpartial(self._choose_save_session))
self._actions['session_save'] = a
Expand Down Expand Up @@ -851,6 +852,11 @@ def _create_actions(self):
a.triggered.connect(nonpartial(self._reset_session))
self._actions['session_reset'] = a

a = action('Export D&ata/Subsets', self,
tip='Export data to a file')
a.triggered.connect(nonpartial(self._choose_save_data))
self._actions['export_data'] = a

a = action("Undo", self,
tip='Undo last action',
shortcut=QtGui.QKeySequence.Undo)
Expand Down
2 changes: 1 addition & 1 deletion glue/app/qt/save_data.py
Expand Up @@ -58,7 +58,7 @@ def _sync_subsets(self):

def display_func(subset):
if subset is None:
return "All data"
return "All data (no subsets applied)"
else:
return subset.label

Expand Down
122 changes: 66 additions & 56 deletions glue/app/qt/save_data.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>427</height>
<width>420</width>
<height>472</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -35,10 +35,66 @@
<property name="verticalSpacing">
<number>7</number>
</property>
<item row="6" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="5">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Select the file format to save to:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combosel_subset"/>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="combosel_data"/>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="combosel_exporter"/>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1" colspan="3">
<widget class="QListWidget" name="list_component">
<property name="alternatingRowColors">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QToolButton" name="button_select_all">
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Pick what part of the data you want to save:</string>
<string>Choose what part of the data you want to save:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -67,7 +123,7 @@
<item>
<widget class="QPushButton" name="button_ok">
<property name="text">
<string>OK</string>
<string>Export</string>
</property>
<property name="default">
<bool>true</bool>
Expand Down Expand Up @@ -99,66 +155,20 @@
<item row="0" column="0" colspan="5">
<widget class="QLabel" name="label">
<property name="text">
<string>Pick the dataset and component you want to save:</string>
<string>Choose the dataset and component you want to save:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="combosel_data"/>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="combosel_exporter"/>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="5">
<widget class="QLabel" name="label_2">
<item row="9" column="0" colspan="5">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Select the file format to save to:</string>
<string>Once you click on &quot;Export&quot; you will be prompted to choose the filename.</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QToolButton" name="button_select_all">
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item row="6" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1" colspan="3">
<widget class="QListWidget" name="list_component">
<property name="alternatingRowColors">
<bool>false</bool>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QComboBox" name="combosel_subset"/>
</item>
</layout>
</widget>
<resources/>
Expand Down

0 comments on commit 5e2a568

Please sign in to comment.