Skip to content

Commit

Permalink
Merge pull request #453 from nucleic/atom-main-compat
Browse files Browse the repository at this point in the history
Use enum.IntEnum/IntFlag rather than atom.IntEnum
  • Loading branch information
MatthieuDartiailh committed Sep 21, 2021
2 parents d7940ad + d530150 commit 70a2051
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 37 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@ jobs:
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest')
run: |
bash -c "find . -type f -name '*.gcno' -exec gcov -pb --all-blocks {} +" || true
# Windows does not have C coverage so the upload is a bit different
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
if: (github.event_name != 'schedule' && matrix.os == 'windows-latest')
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest')
Expand Down
6 changes: 3 additions & 3 deletions enaml/core/import_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def locate_module(cls, fullname, path=None):
Returns
-------
result : Instance(AbstractEnamlImporter) or None
result : AbstractEnamlImporter or None
If the Enaml module is located an instance of the importer
that will perform the rest of the operations is returned.
Otherwise, returns None.
Expand Down Expand Up @@ -220,7 +220,7 @@ def locate_module(cls, fullname, path=None):
Returns
-------
results : Instance(AbstractEnamlImporter) or None
results : AbstractEnamlImporter or None
If the Enaml module is located an instance of the importer
that will perform the rest of the operations is returned.
Otherwise, returns None.
Expand Down Expand Up @@ -431,7 +431,7 @@ def locate_module(cls, fullname, path=None):
Returns
-------
results : Instance(AbstractEnamlImporter) or None
results : AbstractEnamlImporter or None
If the Enaml module is located an instance of the importer
that will perform the rest of the operations is returned.
Otherwise, returns None.
Expand Down
12 changes: 7 additions & 5 deletions enaml/drag_drop.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#------------------------------------------------------------------------------
# Copyright (c) 2014, Nucleic Development Team.
# Copyright (c) 2014-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Atom, IntEnum, Typed, Coerced, Tuple, Int
from enum import IntFlag

from atom.api import Atom, Typed, Coerced, Tuple, Int

from .application import Application
from .image import Image
from .mime_data import MimeData


class DropAction(IntEnum):
class DropAction(IntFlag):
""" An enum defining the possible drop actions.
"""
Expand Down Expand Up @@ -56,7 +58,7 @@ class DragData(Atom):

#: The supported drop actions of the drag data. This is an OR'd
#: combination of the available DropAction flags.
supported_actions = Coerced(DropAction.Flags, (DropAction.Move,))
supported_actions = Coerced(DropAction, (DropAction.Move,))

#: The image to use for the drag. If this is not provided, the
#: toolkit will choose a suitable default value.
Expand Down Expand Up @@ -114,7 +116,7 @@ def possible_actions(self):
Returns
-------
result : DropAction.Flags
result : DropAction
The combination of possible drop actions.
"""
Expand Down
2 changes: 1 addition & 1 deletion enaml/layout/strength_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StrengthMember(Value):
__slots__ = ()

def __init__(self, default=None, factory=None):
super(StrengthMember, self).__init__(default, factory)
super(StrengthMember, self).__init__(default, factory=factory)
self.set_validate_mode(Validate.MemberMethod_ObjectOldNew, 'validate')

def validate(self, owner, old, new):
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/docking/q_dock_bar.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import IntEnum
from enum import IntEnum

from enaml.qt.QtCore import (
Qt, QSize, QPoint, QRect, QMargins, QEvent, QObject, QPropertyAnimation,
Expand Down
6 changes: 4 additions & 2 deletions enaml/qt/q_popup_view.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Atom, Bool, Typed, Float, Int, IntEnum
from enum import IntEnum

from atom.api import Atom, Bool, Typed, Float, Int

from .QtCore import (
Qt, QPoint, QPointF, QSize, QRect,QMargins, QPropertyAnimation, QTimer,
Expand Down
4 changes: 2 additions & 2 deletions enaml/qt/qt_drag_drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def possible_actions(self):
Returns
-------
result : DropAction.Flags
result : DropAction
The combination of possible drop actions.
"""
return DropAction.Flags(int(self._q_event.possibleActions()))
return DropAction(int(self._q_event.possibleActions()))

def proposed_action(self):
""" Get the action proposed to be taken by the drop target.
Expand Down
3 changes: 2 additions & 1 deletion enaml/qt/qt_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
import sys
from enum import IntEnum
from weakref import WeakKeyDictionary

from atom.api import Int, IntEnum, Typed
from atom.api import Int, Typed

from enaml.styling import StyleCache
from enaml.widgets.notebook import ProxyNotebook
Expand Down
6 changes: 4 additions & 2 deletions enaml/qt/qt_stack.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Int, IntEnum, Typed
from enum import IntEnum

from atom.api import Int, Typed

from enaml.widgets.stack import ProxyStack

Expand Down
2 changes: 1 addition & 1 deletion enaml/qt/qt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class QtWidget(QtToolkitObject, ProxyWidget):
#: A private copy of the declaration features. This ensures that
#: feature cleanup will proceed correctly in the event that user
#: code modifies the declaration features value at runtime.
_features = Coerced(Feature.Flags)
_features = Coerced(Feature, (0,))

#: Internal storage for the shared widget action.
_widget_action = Typed(QWidgetAction)
Expand Down
4 changes: 2 additions & 2 deletions enaml/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
# possibly small differences in the API, but these changes will come
# backwards compatibility support when possible. Minor releases are
# typically used for large feature additions.
MINOR = 13
MINOR = 14

# The micro release number. The micro release number is incremented
# for bug fix releases and small feature additions.
MICRO = 0

# The status indicate if this is a development or pre-release version
STATUS = ''
STATUS = 'dev'

#: A namedtuple of the version info for the current release.
version_info = namedtuple('version_info', 'major minor micro status')
Expand Down
6 changes: 4 additions & 2 deletions enaml/widgets/dock_events.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Atom, IntEnum, Typed, Str
from enum import IntEnum

from atom.api import Atom, Typed, Str


class DockEvent(Atom):
Expand Down
10 changes: 6 additions & 4 deletions enaml/widgets/widget.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from enum import IntFlag

from atom.api import (
Bool, IntEnum, Str, Coerced, Typed, ForwardTyped, observe
Bool, Str, Coerced, Typed, ForwardTyped, observe
)

from enaml.colors import ColorMember
Expand Down Expand Up @@ -77,7 +79,7 @@ def focus_previous_child(self):
raise NotImplementedError


class Feature(IntEnum):
class Feature(IntFlag):
""" An IntEnum defining the advanced widget features.
"""
Expand Down Expand Up @@ -130,7 +132,7 @@ class Widget(ToolkitObject, Stylable):
#: Set the extra features to enable for this widget. This value must
#: be provided when the widget is instantiated. Runtime changes to
#: this value are ignored.
features = d_(Coerced(Feature.Flags))
features = d_(Coerced(Feature, (0,)))

#: A reference to the ProxyWidget object.
proxy = Typed(ProxyWidget)
Expand Down
1 change: 1 addition & 0 deletions releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Dates are written as DD/MM/YYYY

0.14.0 - unreleased
-------------------
- use enum.IntEnum/IntFlag instead of atom.IntEnum PR #453
- fix operator bindings in template instances PR #445
- fix FlowLayout error with FlowItems that have non-zero stretch or ortho_stretch PR #448
- add support for styling notebook tabs PR #452
Expand Down

0 comments on commit 70a2051

Please sign in to comment.