Skip to content

Commit b2e729b

Browse files
committed
OWWidget: Deprecate buttons_area_orientation
1 parent 0f95c83 commit b2e729b

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

Orange/widgets/widget.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import os
66
import types
7+
import warnings
78

89
from AnyQt.QtWidgets import (
910
QWidget, QDialog, QVBoxLayout, QSizePolicy, QApplication, QStyle,
@@ -66,6 +67,14 @@ def __new__(mcs, name, bases, kwargs):
6667
return cls
6768

6869

70+
class _NoValue:
71+
"""No value (not set) marker."""
72+
def __repr__(self):
73+
return "<No Value>"
74+
75+
_NoValue = _NoValue()
76+
77+
6978
class OWWidget(QDialog, OWComponent, Report, ProgressBarMixin,
7079
WidgetMessagesMixin, WidgetSignalsMixin,
7180
metaclass=WidgetMetaClass):
@@ -115,10 +124,15 @@ class OWWidget(QDialog, OWComponent, Report, ProgressBarMixin,
115124
want_main_area = True
116125
#: Should the widget construct a `controlArea`.
117126
want_control_area = True
127+
118128
#: Orientation of the buttonsArea box; valid only if
119129
#: `want_control_area` is `True`. Possible values are Qt.Horizontal,
120130
#: Qt.Vertical and None for no buttons area
121-
buttons_area_orientation = Qt.Horizontal
131+
#:
132+
#: .. deprecated:: 3.5.0
133+
#: `buttonsArea` is deprecate and (by default) unused.
134+
buttons_area_orientation = _NoValue
135+
122136
#: Specify whether the default message bar widget should be created
123137
#: and placed into the default layout. If False then clients are
124138
#: responsible for displaying messages within the widget in an
@@ -281,6 +295,13 @@ def _insert_splitter(self):
281295
def _insert_control_area(self):
282296
self.left_side = gui.vBox(self.splitter, spacing=0)
283297
self.splitter.setSizes([1]) # Smallest size allowed by policy
298+
if self.buttons_area_orientation is not _NoValue:
299+
warnings.warn(
300+
"`buttons_area_orientation` (and consequently `buttonArea`) "
301+
"is deprecated and will be removed in the future",
302+
category=DeprecationWarning,
303+
)
304+
284305
if self.buttons_area_orientation is not None:
285306
self.controlArea = gui.vBox(self.left_side, addSpace=0)
286307
self._insert_buttons_area()
@@ -295,9 +316,13 @@ def _insert_control_area(self):
295316
self.controlArea.layout().setContentsMargins(m, m, m, m)
296317

297318
def _insert_buttons_area(self):
319+
if self.buttons_area_orientation is _NoValue:
320+
orientation = Qt.Horizontal
321+
else:
322+
orientation = self.buttons_area_orientation
298323
self.buttonsArea = gui.widgetBox(
299324
self.left_side, addSpace=0, spacing=9,
300-
orientation=self.buttons_area_orientation)
325+
orientation=orientation)
301326

302327
def _insert_main_area(self):
303328
self.mainArea = gui.vBox(

0 commit comments

Comments
 (0)