Skip to content

Commit

Permalink
Merge pull request #902 from astrofrog/app-scrollbars-v2
Browse files Browse the repository at this point in the history
Add scrollbars for small screens
  • Loading branch information
astrofrog committed Mar 30, 2016
2 parents f6cc8d0 + e7f55e8 commit 931c1c7
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ v0.8 (unreleased)
v0.7.1 (2016-03-29)
-------------------

* Fix issue with small screens and layer and viewer options by adding
scrollbars. [#902]

* Fixed a failure due to a missing Qt import in glue.core.roi. [#901]

* Fixed a bug that caused an abort trap if the filename specified on the
Expand Down
23 changes: 22 additions & 1 deletion glue/app/qt/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def __init__(self, data_collection=None, session=None):
self.new_tab()
self._update_plot_dashboard(None)

self._layer_views = {}
self._options_widgets = {}

self._load_settings()

def _setup_ui(self):
Expand Down Expand Up @@ -381,14 +384,32 @@ def gather_current_tab(self):
self.current_tab.tileSubWindows()

def _get_plot_dashboards(self, sub_window):

if not isinstance(sub_window, GlueMdiSubWindow):
return QtGui.QWidget(), QtGui.QWidget(), ""

widget = sub_window.widget()
if not isinstance(widget, DataViewer):
return QtGui.QWidget(), QtGui.QWidget(), ""

return widget.layer_view(), widget.options_widget(), str(widget)
layer_view = widget.layer_view()
options_widget = widget.options_widget()

if layer_view not in self._layer_views:
layer_view_scroll = QtGui.QScrollArea()
layer_view_scroll.setFrameShape(QtGui.QFrame.NoFrame)
layer_view_scroll.setWidgetResizable(True)
layer_view_scroll.setWidget(layer_view)
self._layer_views[layer_view] = layer_view_scroll

if options_widget not in self._options_widgets:
options_widget_scroll = QtGui.QScrollArea()
options_widget_scroll.setFrameShape(QtGui.QFrame.NoFrame)
options_widget_scroll.setWidgetResizable(True)
options_widget_scroll.setWidget(options_widget)
self._options_widgets[options_widget] = options_widget_scroll

return self._layer_views[layer_view], self._options_widgets[options_widget], str(widget)

def _clear_dashboard(self):

Expand Down
43 changes: 28 additions & 15 deletions glue/viewers/histogram/qt/layer_style_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>232</width>
<height>48</height>
<width>150</width>
<height>124</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -20,16 +20,10 @@
<property name="margin">
<number>0</number>
</property>
<item row="1" column="2">
<widget class="QColorBox" name="label_color">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
<string>Alpha:</string>
</property>
</widget>
</item>
Expand All @@ -40,7 +34,20 @@
</property>
</widget>
</item>
<item row="2" column="2" colspan="2">
<item row="3" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="3">
<widget class="QSlider" name="slider_alpha">
<property name="maximum">
<number>100</number>
Expand All @@ -50,10 +57,16 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<item row="1" column="1">
<widget class="QColorBox" name="label_color">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Alpha:</string>
<string/>
</property>
</widget>
</item>
Expand Down
23 changes: 21 additions & 2 deletions glue/viewers/scatter/qt/layer_style_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>255</width>
<height>84</height>
<width>237</width>
<height>100</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
Expand Down Expand Up @@ -106,6 +112,19 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="6">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
Expand Down

0 comments on commit 931c1c7

Please sign in to comment.