Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an OS-specific wrapper for notifications in --bubble mode. #66

Open
GijsTimmers opened this issue Feb 13, 2015 · 4 comments
Open

Comments

@GijsTimmers
Copy link
Owner

notify2 works great on Linux distros, but it fails to run on Mac OS. I propose to create a wrapper, like the legacy pinger.py, that checks on what OS we are. If we are on Linux, just use notify2. If we are on a Mac, use pync.

This wrapper would just go in the tools directory. All if-else-statements are encapsulated there, so we can just run it from bubblec.py without having to put the if-else there.

We need some a dev testing this implementation. Pinging @Wouter92....

@jovanbulck
Copy link
Collaborator

Good idea, but I wouldn't put it in the tools dir; that would screw up cohesion as tools would become a bunch of unrelated things. It should on the contrary be a bunch of common things that are useful for more then a single communicator

Basically, buublec.py could declare some (sub)class MacBubbleCommunicator or so and the factory is responsible for creation, so it could check the os and act accordingly. This will be completely transparent :-)

Note: this approach maybe requires declaring the MacCommunicator in a separate file, so that it can use lazy importing as discussed here (bottom)

@GijsTimmers
Copy link
Owner Author

So you mean something like this?

def createBubbleCommunicator(self):
    from bubblec import LinuxLoginBubbleCommunicator, MacLoginBubbleCommunicator
    if sys.platform  == "linux2"
        return LinuxLoginBubbleCommunicator()
    elif sys.platform == "darwin":
        return MacLoginBubbleCommunicator()

That would be fine for me, at least.

@jovanbulck
Copy link
Collaborator

So you mean something like this?

Yep that would be the idea more or less I think, but import the corresponding communicator just before returning (to avoid having to import macCommunicator when not on mac and vica versa)

@GijsTimmers GijsTimmers changed the title Create a OS-specific wrapper for notifications in --bubble mode. Create an OS-specific wrapper for notifications in --bubble mode. Feb 16, 2015
@GijsTimmers
Copy link
Owner Author

Ah, yes, nice!

@GijsTimmers GijsTimmers added this to the 3.0.0: 'Cape Cod' milestone Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants