[ENH] Pull YAML feed of notifications on startup, refactor notifications#3933
[ENH] Pull YAML feed of notifications on startup, refactor notifications#3933lanzagar merged 3 commits intobiolab:masterfrom
Conversation
e53e676 to
779d16a
Compare
e7c1bd5 to
d10e74f
Compare
d10e74f to
7185bcc
Compare
Orange/canvas/utils/overlay.py
Outdated
| """ | ||
| Return the currently displayed widget. | ||
| # get singleton instance | ||
| self = cls() |
There was a problem hiding this comment.
Prefer a
def __init__(self):
raise TypeError(
"`NotificationServer` is a singleton and cannot be instantiated. "
"`Use NotificationServer.instance()` instead"
)
@classmethod
def instance(cls) -> NotificationServer:
"""
Return the single instance of the NotificationServer class.
Returns
-------
instance: NotificationServer
"""
if cls.__instance is None:
cls.__instance = NotificationServer.__new__(NotificationServer)
super(NotificationServer, cls.__instance).__init__()
return cls.__instanceand use a NotificationServer.instance() to get the instance. It's clearer and does not need a metaclass (which is too heavy handed for this).
Does the NotificationServer actually need to be a Singleton. From what I can see it is (first) created in main() and is passed to the first main window from whence it propagates further to new windows. That only leaves thepull_notifications() in __main__ which could easily take the instance created in main() as a parameter.
It is not hard to envision multiple separate queues.
There was a problem hiding this comment.
@ales-erjavec, I think that we could still avoid singletons. If an instance is created in main and simply attached to something (module?) that is accessible anywhere, it would still address my concern.
9ace1cc to
4bfd759
Compare
4bfd759 to
af847bd
Compare
da882dd to
c9d31a6
Compare
Codecov Report
@@ Coverage Diff @@
## master #3933 +/- ##
=======================================
Coverage 85.26% 85.26%
=======================================
Files 385 385
Lines 68762 68762
=======================================
Hits 58630 58630
Misses 10132 10132 |
c9d31a6 to
15a36de
Compare
Orange/util.py
Outdated
| import warnings | ||
|
|
||
| try: | ||
| from PyQt5.QtCore import pyqtWrapperType |
There was a problem hiding this comment.
While we (probably?) don't support PyQt4 anymore it would still be better to use AnyQt for imports...
| requests | ||
| openTSNE>=0.3.0 | ||
| pandas | ||
| pyyaml |
There was a problem hiding this comment.
Found it: __main__.py L26
15a36de to
efc38ea
Compare
Should be merged after biolab/orange-canvas-core#15.
Issue
Likely the final pull request implementing #3372.
Description of changes
Includes