Re: [Pythonmac-SIG] python program in menu bar
scott herzinger <[EMAIL PROTECTED]> writes: > This document > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/HID/intro/chapter_1_section_1.html#/ > > /apple_ref/doc/uid/TP4970-CH202-DontLinkElementID_10 > > is a guide to working with HID devices. It provides some sample code > for accessing and controlling HID devices. An OOC is an "on/off > control". > > The following might also be a useful guide: > > http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html#/ > > /apple_ref/doc/uid/TP3376 Thanks again for those pointers! I looked through them but didn't find anything about OOCs. And a search of the apple developer connection website for "on/off control" only turns up hits about power buttons. I did find two links that might be relevant. This first says there is an "ADB/USB shim [that] allows applications to set the caps lock LED on the Apple USB keyboard", but I'm not sure if this will be helpful: http://developer.apple.com/documentation/Hardware/Developer_Notes/Macintosh_CPUs-G4/PowerMac_G4_16Feb00/G4Rev3-43.html The second mentions kHIDUsage_KeyboardLockingCapsLock: http://developer.apple.com/samplecode/GLCarbonAGLFullScreen/listing12.html Unfortunately, given that I've never programmed in Objective C before, this is probably getting beyond what I have time to figure out myself. I may try asking on another list to see if someone can point to explicit code that already does what I want. I appreciate everything that people on this list have done! Dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
This document http://developer.apple.com/documentation/DeviceDrivers/Conceptual/HID/intro/chapter_1_section_1.html#/ /apple_ref/doc/uid/TP4970-CH202-DontLinkElementID_10 is a guide to working with HID devices. It provides some sample code for accessing and controlling HID devices. An OOC is an "on/off control". The following might also be a useful guide: http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html#/ /apple_ref/doc/uid/TP3376 Scott On Oct 4, 2007, at 10:58 PM, Dan Christensen wrote: > scott herzinger <[EMAIL PROTECTED]> writes: > >> I assume, but don't know for certain, that MacBook keyboards are USB >> HID devices. In that case, this document: >> >> http://www.usb.org/developers/devclass_docs/Hut1_11.pdf >> >> discusses extended HID usages, including those which can be used in >> toggling on/off controls, of which LEDs are one instance. >> >> From there, I'd go to the IOKit framework and see what APIs exist for >> playing with OOCs. IOHIDUsageTables.h contains useful constants. > > Thanks for those pointers. Unfortunately, I did a fair bit of > googling > but couldn't find anything about how to play with OOCs. The pdf you > linked to, and the .h file you mention, say to use "single button > toggle" mode, but I couldn't find anything about that, either. > > Any other suggestions? Is there a more appropriate mailing list I > should try? > > Thanks, > > Dan > > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
scott herzinger <[EMAIL PROTECTED]> writes: > I assume, but don't know for certain, that MacBook keyboards are USB > HID devices. In that case, this document: > > http://www.usb.org/developers/devclass_docs/Hut1_11.pdf > > discusses extended HID usages, including those which can be used in > toggling on/off controls, of which LEDs are one instance. > > From there, I'd go to the IOKit framework and see what APIs exist for > playing with OOCs. IOHIDUsageTables.h contains useful constants. Thanks for those pointers. Unfortunately, I did a fair bit of googling but couldn't find anything about how to play with OOCs. The pdf you linked to, and the .h file you mention, say to use "single button toggle" mode, but I couldn't find anything about that, either. Any other suggestions? Is there a more appropriate mailing list I should try? Thanks, Dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
I assume, but don't know for certain, that MacBook keyboards are USB HID devices. In that case, this document: http://www.usb.org/developers/devclass_docs/Hut1_11.pdf discusses extended HID usages, including those which can be used in toggling on/off controls, of which LEDs are one instance. From there, I'd go to the IOKit framework and see what APIs exist for playing with OOCs. IOHIDUsageTables.h contains useful constants. Scott On Oct 2, 2007, at 12:15 AM, Dethe Elza wrote: > Hi Dan, > > On 10/1/07, Dan Christensen <[EMAIL PROTECTED]> wrote: >> Another question: is there a way I can make an LED on my MacBook Pro >> flash? My program is a mail notifier, and I'd like to know when I >> have >> new mail without unblanking my screen, something I'm used to with >> xbuffy >> under linux. The LEDs I'm thinking of are the caplocks light, the >> light >> to the left of the latch for the lid, and the LED on the power >> connector, but if there's another I haven't thought of that would be >> fine too. A google search didn't turn anything up... > > I agree that would be cool to do, but I don't know how to do it. Does > anyone else here know how to blink the LEDs on a MacBook? > > --Dethe > ___ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Hi Dan, On 10/1/07, Dan Christensen <[EMAIL PROTECTED]> wrote: > Another question: is there a way I can make an LED on my MacBook Pro > flash? My program is a mail notifier, and I'd like to know when I have > new mail without unblanking my screen, something I'm used to with xbuffy > under linux. The LEDs I'm thinking of are the caplocks light, the light > to the left of the latch for the lid, and the LED on the power > connector, but if there's another I haven't thought of that would be > fine too. A google search didn't turn anything up... I agree that would be cool to do, but I don't know how to do it. Does anyone else here know how to blink the LEDs on a MacBook? --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Another question: is there a way I can make an LED on my MacBook Pro flash? My program is a mail notifier, and I'd like to know when I have new mail without unblanking my screen, something I'm used to with xbuffy under linux. The LEDs I'm thinking of are the caplocks light, the light to the left of the latch for the lid, and the LED on the power connector, but if there's another I haven't thought of that would be fine too. A google search didn't turn anything up... Dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Dan wrote: > Thanks so much for that. It was quite easy to adapt it to my needs, > even though I don't understand the Cocoa side of the code. A few > questions: Glad it helped. I recommend getting familiar with the Cocoa libraries, they are quite rich, and PyObjC makes it very easy to experiment. The AppKiDo application makes it very easy to browse and search the documentation. > 1) I noticed that my code runs fine directly from the shell prompt, so > I'm curious what the advantage of making a real .app is. I guess this > would allow me to add the program as a "Startup Item". (Or can one > run any command as a Startup Item?) Making it a real application makes it double-clickable from the Finder and may make it behave better with other Cocoa applications. You will see your application's name when you switch to it, rather than "Python." And I think Startup Items are expected to be .app applications, although I wouldn't swear to it. It's relatively easy to make it a .app with py2app, and good practice for when you develop a killer app that you want to distribute far and wide. > 2) It is easy to change the colour of the title text that appears > in the menu bar? It should be. I'm borrowing my wife's computer right now (mine was stolen recently) so I don't actually have the docs handy, but it should be easy to figure out. I think NSAttributedString is the relevant class to start with. > 3) Is it easy to generate a beep of some sort? NSBeep is your friend. > I plan to look over some of the PyObjC documentation and examples, and I > apologize if some of this is answered there. Thanks again for pointing > out your code to me, as it is almost exactly what I was looking for! All of it is answerd in the Cocoa docs, but the hard part is knowing where to start. I hope I've been able to give you some good starting points. I'm glad the code example was helpful. One of these days I'm going to get my weblog working again, and I'll post it as a tutorial. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
"Dethe Elza" <[EMAIL PROTECTED]> writes: > On 9/26/07, Dan Christensen <[EMAIL PROTECTED]> wrote: >> Can anyone point to a simple example of a python program that runs in >> the menu bar? I'd like a program that just displays a few characters of >> text in the menu bar, and updates the display once a minute or so. > > I posted a very simple example of getting an NSStatusItem using PyObjC > on this list awhile back: > http://mail.python.org/pipermail/pythonmac-sig/2005-April/013731.html Thanks so much for that. It was quite easy to adapt it to my needs, even though I don't understand the Cocoa side of the code. A few questions: 1) I noticed that my code runs fine directly from the shell prompt, so I'm curious what the advantage of making a real .app is. I guess this would allow me to add the program as a "Startup Item". (Or can one run any command as a Startup Item?) 2) It is easy to change the colour of the title text that appears in the menu bar? 3) Is it easy to generate a beep of some sort? I plan to look over some of the PyObjC documentation and examples, and I apologize if some of this is answered there. Thanks again for pointing out your code to me, as it is almost exactly what I was looking for! Dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] python program in menu bar
Hi Dan, On 9/26/07, Dan Christensen <[EMAIL PROTECTED]> wrote: > Can anyone point to a simple example of a python program that runs in > the menu bar? I'd like a program that just displays a few characters of > text in the menu bar, and updates the display once a minute or so. The first thing to figure out is that Apple calls an app that can live in the menu bar "NSStatusItem". Knowing that makes it a LOT easier to find documentation for writing them. I highly recommend getting a copy of AppKiDo to browse the Cocoa docs, if you don't already have it. I posted a very simple example of getting an NSStatusItem using PyObjC on this list awhile back: http://mail.python.org/pipermail/pythonmac-sig/2005-April/013731.html Let me know if it helps, or if you need more help getting going. --Dethe ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
[Pythonmac-SIG] python program in menu bar
Can anyone point to a simple example of a python program that runs in the menu bar? I'd like a program that just displays a few characters of text in the menu bar, and updates the display once a minute or so. Thanks, Dan ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig