Giter Club home page Giter Club logo

rumps's Introduction

rumps

Ridiculously Uncomplicated Mac os x Python Statusbar apps.

image

import rumps

class AwesomeStatusBarApp(rumps.App):
    def __init__(self):
        super(AwesomeStatusBarApp, self).__init__("Awesome App")
        self.menu = ["Preferences", "Silly button", "Say hi"]

    @rumps.clicked("Preferences")
    def prefs(self, _):
        rumps.alert("jk! no preferences available!")

    @rumps.clicked("Silly button")
    def onoff(self, sender):
        sender.state = not sender.state

    @rumps.clicked("Say hi")
    def sayhi(self, _):
        rumps.notification("Awesome title", "amazing subtitle", "hi!!1")

if __name__ == "__main__":
    AwesomeStatusBarApp().run()

How fun!?

rumps can greatly shorten the code required to generate a working app. No PyObjC underscore syntax required!

Use case

rumps is for any console-based program that would benefit from a simple configuration toolbar or launch menu.

Good for:

  • Notification-center-based app
  • Controlling daemons / launching separate programs
  • Updating simple info from web APIs on a timer

Not good for:

  • Any app that is first and foremost a GUI application

Required

  • PyObjC
  • Python 2.6+

Mac OS X 10.6 was shipped with Python 2.6 as the default version and PyObjC has been included in the default Python since 10.5. If you're using Mac OS X 10.6+ and the default Python that came with it, then rumps should be good to go!

  • py2app

For creating standalone apps, just make sure to include rumps in the packages list. Most simple statusbar-based apps are just "background" apps (no icon in the dock; inability to tab to the application) so it is likely that you would want to set 'LSUIElement' to True. A basic setup.py would look like,

from setuptools import setup

APP = ['example_class.py']
DATA_FILES = []
OPTIONS = {
    'argv_emulation': True,
    'plist': {
        'LSUIElement': True,
    },
    'packages': ['rumps'],
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

With this you can then create a standalone,

python setup.py py2app

Installation

Using pip,

pip install rumps

Or from source,

python setup.py install

Both of which will require sudo if installing in a system-wide location.

Documentation

Documentation is available at http://rumps.readthedocs.org

License

"Modified BSD License". See LICENSE for details. Copyright Jared Suttles, 2014.

rumps's People

Contributors

danpalmer avatar hiroshi avatar jaredks avatar stakodiak avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.