pysystray-users Mailing List for pySystray-win32
Status: Beta
Brought to you by:
essiene
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(23) |
Oct
(4) |
Nov
(8) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
2007 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
From: Florian L. <fl...@la...> - 2009-10-27 19:06:16
|
Hi, How can I remove the default menu item "Quit? Btw: I opened a support request here: https://sourceforge.net/tracker/?func=detail <https://sourceforge.net/tracker/?func=detail&atid=763255&aid=2886108&group_ id=145849> &atid=763255&aid=2886108&group_id=145849 but I think the tracer isn't read by anyone. Thanks in advance, regards |
From: Florian L. <fl...@la...> - 2009-10-27 19:06:01
|
Oh, I just saw this is a duplicate of the post from John Bunting, but no answer since 2008-09-17 14:15 Since there is no answer since then - don't tell me it isn't possible. If so, this should be fixed. Regards, Florian Von: Florian Lagg [mailto:fl...@la...] Gesendet: Dienstag, 27. Oktober 2009 19:52 An: 'pys...@li...' Betreff: Remove MenuItem "Quit" Hi, How can I remove the default menu item "Quit? Btw: I opened a support request here: https://sourceforge.net/tracker/?func=detail <https://sourceforge.net/tracker/?func=detail&atid=763255&aid=2886108&group_ id=145849> &atid=763255&aid=2886108&group_id=145849 but I think the tracer isn't read by anyone. Thanks in advance, regards |
From: John B. <cod...@gm...> - 2008-09-17 14:15:26
|
I am experimenting with creating a system tray icon for an application. I would like to create a system try icon that does not have the "quit" menu. I was wondering if it is possible to actually get rid of this or hide it so that it can't be clicked! (I have a service running that I don't want to have someone quit!) Thanks for your help everyone! ~John |
From: Killian, J. <Jan...@Co...> - 2008-04-03 07:50:35
|
Hi Essien, Could you kindly send me this patch and also the older one for LoadImage memory leak? I tried to dl them from sourceforge, but the files are not in archive anymore :( I'm sorry if I missed some repository, where I can get them from; just checked sf cvs. btw, I'm sure you have many things to craft, but the svn repo would be great ;) Good luck, Jan ___ Essien Ita Essien wrote: Thnx for the patch. Will review it add include as appropriate. I'll also be putting up a public svn repo on google code to make creating patches a bit easier. cheers, Essien Charles Duffy wrote: > The attached patch allows arbitrary keyword arguments to be passed > into PackMENUITEMINFO (to allow the user to perform bolding and > graying out; add separator bars, etc), gets rid of the > automatically-added QUIT menu item (so the user can put QUIT wherever > on the menu they like, and name it appropriately). > > Enjoy! |
From: Essien I. E. <es...@da...> - 2007-01-10 09:58:53
|
Thnx for the patch. Will review it add include as appropriate. I'll also be putting up a public svn repo on google code to make creating patches a bit easier. cheers, Essien Charles Duffy wrote: > The attached patch allows arbitrary keyword arguments to be passed > into PackMENUITEMINFO (to allow the user to perform bolding and > graying out; add separator bars, etc), gets rid of the > automatically-added QUIT menu item (so the user can put QUIT wherever > on the menu they like, and name it appropriately). > > Enjoy! > ------------------------------------------------------------------------ > > diff -ru systray-0.6.1.orig/src/SysTrayIcon.py systray-0.6.1/src/SysTrayIcon.py > --- systray-0.6.1.orig/src/SysTrayIcon.py 2005-09-29 00:42:08.000000000 -0500 > +++ systray-0.6.1/src/SysTrayIcon.py 2007-01-09 11:46:18.105000000 -0600 > @@ -21,6 +21,26 @@ > > import winutils > > +class ImmutableDict(dict): > + '''A hashable dict.''' > + > + def __init__(self,*args,**kwds): > + dict.__init__(self,*args,**kwds) > + def __setitem__(self,key,value): > + raise NotImplementedError, "dict is immutable" > + def __delitem__(self,key): > + raise NotImplementedError, "dict is immutable" > + def clear(self): > + raise NotImplementedError, "dict is immutable" > + def setdefault(self,k,default=None): > + raise NotImplementedError, "dict is immutable" > + def popitem(self): > + raise NotImplementedError, "dict is immutable" > + def update(self,other): > + raise NotImplementedError, "dict is immutable" > + def __hash__(self): > + return hash(tuple(self.iteritems())) > + > class SysTrayIcon(object): > '''TODO''' > #TODO: move into local method namespaces. No need to be global really > @@ -69,7 +89,7 @@ > def _add_ids_to_menu_options(self, menu_options): > result = [] > for menu_option in menu_options: > - option_text, option_icon, option_action = menu_option > + option_text, option_icon, option_action, option_kwargs = menu_option > if callable(option_action) or option_action in self.SPECIAL_ACTIONS: > self.menu_actions_by_id.add((self._next_action_id, option_action)) > result.append(menu_option + (self._next_action_id,)) > @@ -77,16 +97,17 @@ > result.append((option_text, > option_icon, > self._add_ids_to_menu_options(option_action), > + option_kwargs, > self._next_action_id)) > else: > - #print 'Unknown item', option_text, option_icon, option_action > + #print 'Unknown item', option_text, option_icon, option_action, option_kwargs > pass > self._next_action_id += 1 > return result > > def _prepare_menu(self, menu_options, default_menu_index=None): > #prepare menu > - menu_options = menu_options + (('Quit', None, self.QUIT),) > + #menu_options = menu_options + (('Quit', None, self.QUIT, ImmutableDict()),) > self._next_action_id = self.FIRST_ID > self.menu_actions_by_id = set() > self.menu_options = self._add_ids_to_menu_options(list(menu_options)) > @@ -202,21 +223,24 @@ > win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) > > def create_menu(self, menu, menu_options): > - for option_text, option_icon, option_action, option_id in menu_options[::-1]: > + for menu_option in menu_options[::-1]: > + option_text, option_icon, option_action, option_kwargs, option_id = menu_option > if option_icon: > option_icon = self.prep_menu_icon(option_icon) > > - if option_id in self.menu_actions_by_id: > + if option_id in self.menu_actions_by_id: > item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text, > hbmpItem=option_icon, > - wID=option_id) > + wID=option_id, > + **option_kwargs) > win32gui.InsertMenuItem(menu, 0, 1, item) > else: > submenu = win32gui.CreatePopupMenu() > self.create_menu(submenu, option_action) > item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text, > hbmpItem=option_icon, > - hSubMenu=submenu) > + hSubMenu=submenu, > + **option_kwargs) > win32gui.InsertMenuItem(menu, 0, 1, item) > > def prep_menu_icon(self, icon): > diff -ru systray-0.6.1.orig/src/menu.py systray-0.6.1/src/menu.py > --- systray-0.6.1.orig/src/menu.py 2005-09-29 01:29:00.000000000 -0500 > +++ systray-0.6.1/src/menu.py 2007-01-09 11:46:18.105000000 -0600 > @@ -1,7 +1,7 @@ > import utils > > __all__ = ['Menu', 'MenuItem'] > - > +from SysTrayIcon import ImmutableDict > > #TODO: find a mature OrderedDict implementation > > @@ -28,10 +28,21 @@ > self.append(title) > self.append(None) > self.append(utils.DEFAULT_HANDLER) > + self.append({}) > self.name = name > #if not name: > # self.name = title > - > + > + def __getitem__(self, item, *args): > + if isinstance(item, int): > + return list.__getitem__(self, item, *args) > + return self[3].__getitem__(item, *args) > + > + def __setitem__(self, item, value): > + if isinstance(item, int): > + return list.__setitem__(self, item, value) > + return self[3].__setitem__(item, value) > + > def __get_title(self): > return self[0] > > @@ -51,7 +62,7 @@ > icon = property(__get_icon, __set_icon, None, "Sets/Gets the menu icon") > > def get_tuple(self): > - return tuple(self) > + return tuple(self)[:3] + ((ImmutableDict(self[3]),)) > > > > @@ -115,4 +126,4 @@ > self[2] = h > > onclick = property(__get_onclick, __set_onclick, None, "Sets/Gets the onclick handler for the MenuItem") > - > \ No newline at end of file > + > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ------------------------------------------------------------------------ > > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > |
From: Charles D. <cd...@sp...> - 2007-01-09 17:50:47
|
The attached patch allows arbitrary keyword arguments to be passed into PackMENUITEMINFO (to allow the user to perform bolding and graying out; add separator bars, etc), gets rid of the automatically-added QUIT menu item (so the user can put QUIT wherever on the menu they like, and name it appropriately). Enjoy! |
From: Essien I. E. <es...@da...> - 2006-12-11 16:57:50
|
Hi Everybody, I'm using this medium to do some cheap, shameless advertisement for another project I've started work on. Its been quite on the pysystray front for quite a while :) Anyways, I've been busy on a lot of other things, and recently, I've been working on a web framework (yeah! I just had to inflict YAPWF - yet another python web framework - on the python world :)). Its intentionally designed to be light like web.py but contain a bit more stuff for getting work done - like Django, but like TurboGears it reuses existing python components. I don't think i built anything by myself, just put stuff together in a light and easy way. Anyways, this is a shameless cheap advertisement for 'simpleweb' . If you like the way pysystray works, you'll probably like the way 'simpleweb' works... Its the same 'Get-Stuff-Done' approach I took to both of them. If you're interested check it out at http://simpleweb.essienitaessien.com Also, I'm playing with an idea that will allow you to build browser based apps that run on win32 systems via pysystray/simpleweb. I'm working on a Howto that will show how to easily do that. Ok... enuff already :) cheers, Essien |
From: Essien I. E. <es...@da...> - 2006-09-15 09:14:29
|
Christian Keydel wrote: > Hi Essien, > > Thanks for your response! > > <snip> > > that's the way I would do it :) > > Thanks again for the suggestion, but it raised more questions from a > n00b like me when it comes to Win32 programming. How do I open the > socket? How do I check if a message is waiting before I get it, in case > I need the thread to be always running? I actually tried to open a local > socket using 'localhost' and '127.0.0.1' and got a "connection refused" > error, so I gave up. > there are some socket examples in the std documentation, i learnt them from there meself :) > However, I found an (IMHO) easier option using a queue. Here is my solution: > > import Queue > ... > msg_queue = Queue.Queue() > ... > @systray.threaded > def my_lil_thread(): > new_value = 0 > while (1): > if not msg_queue.empty(): > new_value = msg_queue.get() > if new_value == 123 # Do whatever... > ... > > # Then in the callback for a menu item: > > msg_queue.put(123) # Cause my_lil_thread to do whatever > > nice... and simpler too :) > I believe it works because the thread "inherits" all global objects that > exist in the module at the time the thread is started (or defined, I > don't know) and because msg_queue is a reference that remains static > once the queue is opened, and the queue itself is a sharable object that > is accessible from all threads. It is probably not the right way to do > it and a Python expert might scream in horror but it works fine! :-) > scream in horror? hehe... good solution is one with less code, less mind bending, simple to understand. this is an elegant solution. Once more... my overtly complex mind overlooks simple solutions, but yay! for the n00b!!! ;) > Cheers, > Chris > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > |
From: Christian K. <chr...@gm...> - 2006-09-15 00:27:54
|
Hi Essien, Thanks for your response! > > I am stuck at what seems like a simple thing: I have spawned one thread > > automatically on load of the taskbar icon. That was easy. Now I need > > this thread to change it's behaviour depending on what menu items I > > selected. I have a global variable that each menu item can set, but the > > thread doesn't see it. > > > > After what I could google on it it seems the threads run in their own > > space. I found some examples for communication between threads but only > > for class-threads and not the type function-thread that pysystray uses, > > plus it seems complicated. > > > Indeed threads can't communicate via 'global' anythings really, unless > via some complex mechanisms... Windows I think builds up that frame work > for threads into a message passing system i think. must have read that > somewhere. > > What is the most simplistic approach to change a parameter "globally" so > > that the thread can see it? I tried a get_val() function but that > > doesn't work either and the thread always sees 0. > > > > The way I see, it, what you could do would be to use sockets. On UNIX i > would say use socket.AF_LOCAL but in windows, you can just use the > normal INET sockets. > > It seems to me that your on_load thread is the main thread that others > can control no? In that case, you can make it a server, that listens for > values from clients. Then each of your menu items will do a simple > socket.socket(), connect(), send(). The server picks up the message and > works with it. > > You can make this all simple by building a simple module to abstract the > client messages, so you could have: > > > foobar.client_send(foobar.COOL_VALUE) > > then in the server you could do, > > while 1: > msg = foobar_server.get_msg() > if msg == foobar.COOL_VALUE: > #meh > if msg == foobar.UNCOOL_VALUE: > #more meh! > > that's the way I would do it :) Thanks again for the suggestion, but it raised more questions from a n00b like me when it comes to Win32 programming. How do I open the socket? How do I check if a message is waiting before I get it, in case I need the thread to be always running? I actually tried to open a local socket using 'localhost' and '127.0.0.1' and got a "connection refused" error, so I gave up. However, I found an (IMHO) easier option using a queue. Here is my solution: import Queue ... msg_queue = Queue.Queue() ... @systray.threaded def my_lil_thread(): new_value = 0 while (1): if not msg_queue.empty(): new_value = msg_queue.get() if new_value == 123 # Do whatever... ... # Then in the callback for a menu item: msg_queue.put(123) # Cause my_lil_thread to do whatever I believe it works because the thread "inherits" all global objects that exist in the module at the time the thread is started (or defined, I don't know) and because msg_queue is a reference that remains static once the queue is opened, and the queue itself is a sharable object that is accessible from all threads. It is probably not the right way to do it and a Python expert might scream in horror but it works fine! :-) Cheers, Chris |
From: Essien I. E. <es...@da...> - 2006-09-14 17:06:47
|
Christian Keydel wrote: > Thank you Essien for this great tool! > Thanks for the compliment :) Unfortunately, I no more work at a Windows shop so I don't have the need to improve it much... mayhap someone else may be interested in doing this incrementally? At least fixing bugs that crop up in real world scenarios? *hint* *hint* at Greg @ bittorrent ;) > I am stuck at what seems like a simple thing: I have spawned one thread > automatically on load of the taskbar icon. That was easy. Now I need > this thread to change it's behaviour depending on what menu items I > selected. I have a global variable that each menu item can set, but the > thread doesn't see it. > > After what I could google on it it seems the threads run in their own > space. I found some examples for communication between threads but only > for class-threads and not the type function-thread that pysystray uses, > plus it seems complicated. > Indeed threads can't communicate via 'global' anythings really, unless via some complex mechanisms... Windows I think builds up that frame work for threads into a message passing system i think. must have read that somewhere. > What is the most simplistic approach to change a parameter "globally" so > that the thread can see it? I tried a get_val() function but that > doesn't work either and the thread always sees 0. > The way I see, it, what you could do would be to use sockets. On UNIX i would say use socket.AF_LOCAL but in windows, you can just use the normal INET sockets. It seems to me that your on_load thread is the main thread that others can control no? In that case, you can make it a server, that listens for values from clients. Then each of your menu items will do a simple socket.socket(), connect(), send(). The server picks up the message and works with it. You can make this all simple by building a simple module to abstract the client messages, so you could have: foobar.client_send(foobar.COOL_VALUE) then in the server you could do, while 1: msg = foobar_server.get_msg() if msg == foobar.COOL_VALUE: #meh if msg == foobar.UNCOOL_VALUE: #more meh! that's the way I would do it :) Hope that helps. > Cheers, > Chris > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > |
From: Christian K. <chr...@gm...> - 2006-09-14 15:53:49
|
Thank you Essien for this great tool! I am stuck at what seems like a simple thing: I have spawned one thread automatically on load of the taskbar icon. That was easy. Now I need this thread to change it's behaviour depending on what menu items I selected. I have a global variable that each menu item can set, but the thread doesn't see it. After what I could google on it it seems the threads run in their own space. I found some examples for communication between threads but only for class-threads and not the type function-thread that pysystray uses, plus it seems complicated. What is the most simplistic approach to change a parameter "globally" so that the thread can see it? I tried a get_val() function but that doesn't work either and the thread always sees 0. Cheers, Chris |
From: Sajjad H. <shu...@ya...> - 2006-05-29 21:25:15
|
Hi, I replaced the original bases.py with the one you sent me. I commented out #@systray.threaded in sample.py. However now I am getting this error: [/cygdrive/c/design/Miscellaneous/Taskbar/ pysystray-sample-0.6.1]: python sample.py Traceback (most recent call last): File "sample.py", line 2, in ? from systray import systray File "C:\Python23\Lib\site-packages\systray\systray.py", line 13, in ? import bases File "C:\Python23\lib\site-packages\systray\bases.py", line 177 if _is_supported_version(): ^ SyntaxError: invalid syntax Also the line to be executed if the if statement is true is: @utils.threaded I don't want to play around with bases.py just because I know that I will most likely break it. I hope you would be able to send me another bases.py. Regards, Sajjad --- Essien Ita Essien <es...@da...> wrote: > Sajjad Hussain wrote: > > Hi, > > > > All of my company's software is written with > version > > 2.3.3. So it is very important that any tool, > script > > we write must be consistent with that version. I > don't > > want to break (not a likely chance) any of my code > by > > switching version. Anyways, is there a work around > to > > this problem? It would really shorten my work if I > > integrate pysystray in my project. > > > Hmmm... I've coded this quick 'untested' workaround. > I'm currently not > working from Windows so I don't know if this works. > The idea, is to check sys.version and if its less > than 2.4, I > conditionally define _start_control() to use or not > use the threading > decorator. Its a dirty hack. > > Replace your bases.py with the attached bases.py and > see if that solves > it. You won't for now be able to use the > @systray.threaded decorator > too, so you can comment that out of the sample. > Also, using App.start() > will *block* and won't return till the function > finishes, since it isn't > threaded *anymore* due to this hack. I guess my > *unvoiced* advice is > that you should attempt migrating to 2.4 (it's going > to be a pain to > keep this in sync with 2.3, since i don't use it > anymore, I wouldn't > know when I break it :( ) > > First though, let me know if this works. > > cheers, > Essien > > > > Regards, > > > > Sajjad > > > > --- Essien Ita Essien <es...@da...> > wrote: > > > > > >> Hi, > >> > >> Sorry for replying late... just came back from a > >> loooong weekend (public > >> holiday here :D) > >> > >> Sajjad Hussain wrote: > >> > >>> Hi everyone, > >>> > >>> I have just installed systray-0.6.1.win32.exe on > >>> > >> my > >> > >>> PythonWin 2.3.3. I downloaded > >>> pysystray-sample-0.6.1.zip, unzipped it and > tried > >>> running sample.py. I am getting this error: > >>> > >>> [/cygdrive/c/design/Miscellaneous/ > >>> Taskbar/pysystray-sample-0.6.1]: python > sample.py > >>> > >>> File "sample.py", line 17 > >>> @systray.threaded > >>> ^ > >>> SyntaxError: invalid syntax > >>> > >>> > >> Hmmm... it seems Python 2.3 doesn't support > >> decorators (that's the > >> syntax for decorators)? You should use Python 2.4 > or > >> newer. Any reason > >> you're using 2.3? > >> > >> Cheers, > >> Essien > >> > >> > >> > >> > > > ------------------------------------------------------- > > > >> All the advantages of Linux Managed > Hosting--Without > >> the Cost and Risk! > >> Fully trained technicians. The highest number of > Red > >> Hat certifications in > >> the hosting industry. Fanatical Support. Click to > >> learn more > >> > >> > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > > > >> _______________________________________________ > >> pysystray-users mailing list > >> pys...@li... > >> > >> > > > https://lists.sourceforge.net/lists/listinfo/pysystray-users > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > > > > > ------------------------------------------------------- > > All the advantages of Linux Managed > Hosting--Without the Cost and Risk! > > Fully trained technicians. The highest number of > Red Hat certifications in > > the hosting industry. Fanatical Support. Click to > learn more > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > > _______________________________________________ > > pysystray-users mailing list > > pys...@li... > > > https://lists.sourceforge.net/lists/listinfo/pysystray-users > > > > > import sys > import win32gui > import win32con > import thread > import SysTrayIcon > > import menu > import utils > > __all__ = ['AppBase'] > > > def _is_supported_version(): > supported_version = 2.4 > current_version = > float(sys.version.split()[0][:-2]) > if current_version >= supported_version: > return True > else: > return False > > > class _App(SysTrayIcon.SysTrayIcon): > ''' Inherits SysTrayIcon and adds usefull > properties and extentions ''' > > #TODO: add support for pop up notifier window > def __init__(self, title, icon, menu, > on_load=None, on_quit=None, on_double_click=None): > > self.title = title > self.menu = menu > self.on_double_click = on_double_click > SysTrayIcon.SysTrayIcon.__init__(self, icon, > self.title, > self.menu.get_tuple(), on_load, on_quit, > self.title, behave_traditional=False) #using > self.title as windows_class_name > self.visible = True > self.alive = True > > > def do_onload(self): > win32gui.SendMessage(self.hwnd, > self.WM_ONLOAD, self._get_quit_id(), > win32con.WM_LBUTTONUP) > > def quit(self): > win32gui.SendMessage(self.hwnd, > win32con.WM_COMMAND, self._get_quit_id(), > win32con.WM_LBUTTONUP) > self.visible = False > > def _get_quit_id(self): > for k, v in self.menu_actions_by_id.items(): > if v == self.QUIT: > return k > > def show_menu(self): > #print "showing menu" > self._prepare_menu(self.menu.get_tuple(), 0) > menu = win32gui.CreatePopupMenu() > self.create_menu(menu, self.menu_options) > #win32gui.SetMenuDefaultItem(menu, 1000, 0) > > pos = win32gui.GetCursorPos() > # See > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp > win32gui.SetForegroundWindow(self.hwnd) > win32gui.TrackPopupMenu(menu, > > win32con.TPM_LEFTALIGN, > pos[0], > pos[1], > 0, > self.hwnd, > None) > win32gui.PostMessage(self.hwnd, > win32con.WM_NULL, 0, 0) > > def show_tooltip(self, title, text, timeout=1, > icon=win32gui.NIIF_INFO): > if self.visible: > > self.notify_icon.show_balloon_tooltip(title, text, > icon, timeout) > > def show(self): > if not self.visible: > self.notify_icon.show() > self.visible = True > > def hide(self): > if self.visible: > # nid = (self.hwnd, 0) > # > win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid) > self.notify_icon.hide() > self.visible = False > > #overloaded message handler for WM_DESTROY > def destroy(self, hwnd, msg, wparam, lparam): > if self.on_quit: self.on_quit(self) > self.hide() > win32gui.PostQuitMessage(0) # Terminate the > app. > self.alive = False > > def notify(self, hwnd, msg, wparam, lparam): > if lparam==win32con.WM_LBUTTONDBLCLK: > #allow setting custom dbclick callback > if callable(self.on_double_click): > self.on_double_click(self) > > #self.execute_menu_option(self.default_menu_index + > self.FIRST_ID) > pass > elif lparam==win32con.WM_RBUTTONUP: > self.show_menu() > elif lparam==win32con.WM_LBUTTONUP: > pass > return True > > > def __set_text(self, s): > self.hover_text = s > self.refresh_icon() > > def __get_text(self): > return self.hover_text > > text = property(__get_text, __set_text, None, > "Text Shown On Mouse Hover") > > def __set_icon(self, s): > self._icon = s > self.refresh_icon() > > def __get_icon(self): > return self._icon > > icon = property(__get_icon, __set_icon, None, > "The Icon Shown on the tool bar") > > #TODO: make this guy pop up like Yahoo, but > semitransparent and cool like outlook messages > def set_status(self, message=None, icon=None): > if message is not None: > self.text = self.title + ' - ' + > str(message) > > if icon is not None: > try: > self.icon = icon > except: > #do nothing just let it go for now > #TODO: Raise and _App.Error('Invalid > Icon File') > pass > > def show_info(self, message): > #win32gui.MessageBox(self.hwnd, > str(message), self.title, > win32con.MB_ICONINFORMATION) > self.show_tooltip(self.title, str(message), > icon=win32gui.NIIF_INFO) > > def show_warning(self, message): > self.show_alert(message) > > #TODO: Deprecate This > def show_alert(self, message): > #win32gui.MessageBox(self.hwnd, > str(message), self.title, win32con.MB_ICONERROR) > self.show_tooltip(self.title, str(message), > icon=win32gui.NIIF_WARNING) > > def show_error(self, message): > self.show_tooltip(self.title, str(message), > icon=win32gui.NIIF_ERROR) > > def show_message(self, message): > self.show_tooltip(self.title, str(message), > icon=win32gui.NIIF_NONE) > > > > class AppBase(object): > ''' Creates an instance of a System Tray > Application. Call start() to run it ''' > > def __init__(self, title, icon=None): > self.icon = icon > self.title = title > self._on_quit = utils.DEFAULT_HANDLER > self._on_load = utils.DEFAULT_HANDLER > self._on_double_click = > utils.DEFAULT_HANDLER > self.menu = [] > self.nmenu = menu.MenuRoot() > #self.systray = _App(title, icon, tuple([])) > === message truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Essien I. E. <es...@da...> - 2006-05-29 19:21:59
|
Sajjad Hussain wrote: > Hi, > > All of my company's software is written with version > 2.3.3. So it is very important that any tool, script > we write must be consistent with that version. I don't > want to break (not a likely chance) any of my code by > switching version. Anyways, is there a work around to > this problem? It would really shorten my work if I > integrate pysystray in my project. > Hmmm... I've coded this quick 'untested' workaround. I'm currently not working from Windows so I don't know if this works. The idea, is to check sys.version and if its less than 2.4, I conditionally define _start_control() to use or not use the threading decorator. Its a dirty hack. Replace your bases.py with the attached bases.py and see if that solves it. You won't for now be able to use the @systray.threaded decorator too, so you can comment that out of the sample. Also, using App.start() will *block* and won't return till the function finishes, since it isn't threaded *anymore* due to this hack. I guess my *unvoiced* advice is that you should attempt migrating to 2.4 (it's going to be a pain to keep this in sync with 2.3, since i don't use it anymore, I wouldn't know when I break it :( ) First though, let me know if this works. cheers, Essien > Regards, > > Sajjad > > --- Essien Ita Essien <es...@da...> wrote: > > >> Hi, >> >> Sorry for replying late... just came back from a >> loooong weekend (public >> holiday here :D) >> >> Sajjad Hussain wrote: >> >>> Hi everyone, >>> >>> I have just installed systray-0.6.1.win32.exe on >>> >> my >> >>> PythonWin 2.3.3. I downloaded >>> pysystray-sample-0.6.1.zip, unzipped it and tried >>> running sample.py. I am getting this error: >>> >>> [/cygdrive/c/design/Miscellaneous/ >>> Taskbar/pysystray-sample-0.6.1]: python sample.py >>> >>> File "sample.py", line 17 >>> @systray.threaded >>> ^ >>> SyntaxError: invalid syntax >>> >>> >> Hmmm... it seems Python 2.3 doesn't support >> decorators (that's the >> syntax for decorators)? You should use Python 2.4 or >> newer. Any reason >> you're using 2.3? >> >> Cheers, >> Essien >> >> >> >> > ------------------------------------------------------- > >> All the advantages of Linux Managed Hosting--Without >> the Cost and Risk! >> Fully trained technicians. The highest number of Red >> Hat certifications in >> the hosting industry. Fanatical Support. Click to >> learn more >> >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > >> _______________________________________________ >> pysystray-users mailing list >> pys...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/pysystray-users > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > |
From: Sajjad H. <shu...@ya...> - 2006-05-29 18:05:58
|
Hi, All of my company's software is written with version 2.3.3. So it is very important that any tool, script we write must be consistent with that version. I don't want to break (not a likely chance) any of my code by switching version. Anyways, is there a work around to this problem? It would really shorten my work if I integrate pysystray in my project. Regards, Sajjad --- Essien Ita Essien <es...@da...> wrote: > Hi, > > Sorry for replying late... just came back from a > loooong weekend (public > holiday here :D) > > Sajjad Hussain wrote: > > Hi everyone, > > > > I have just installed systray-0.6.1.win32.exe on > my > > PythonWin 2.3.3. I downloaded > > pysystray-sample-0.6.1.zip, unzipped it and tried > > running sample.py. I am getting this error: > > > > [/cygdrive/c/design/Miscellaneous/ > > Taskbar/pysystray-sample-0.6.1]: python sample.py > > > > File "sample.py", line 17 > > @systray.threaded > > ^ > > SyntaxError: invalid syntax > > > Hmmm... it seems Python 2.3 doesn't support > decorators (that's the > syntax for decorators)? You should use Python 2.4 or > newer. Any reason > you're using 2.3? > > Cheers, > Essien > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without > the Cost and Risk! > Fully trained technicians. The highest number of Red > Hat certifications in > the hosting industry. Fanatical Support. Click to > learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Essien I. E. <es...@da...> - 2006-05-29 17:57:12
|
Hi, Sorry for replying late... just came back from a loooong weekend (public holiday here :D) Sajjad Hussain wrote: > Hi everyone, > > I have just installed systray-0.6.1.win32.exe on my > PythonWin 2.3.3. I downloaded > pysystray-sample-0.6.1.zip, unzipped it and tried > running sample.py. I am getting this error: > > [/cygdrive/c/design/Miscellaneous/ > Taskbar/pysystray-sample-0.6.1]: python sample.py > > File "sample.py", line 17 > @systray.threaded > ^ > SyntaxError: invalid syntax > Hmmm... it seems Python 2.3 doesn't support decorators (that's the syntax for decorators)? You should use Python 2.4 or newer. Any reason you're using 2.3? Cheers, Essien |
From: Sajjad H. <shu...@ya...> - 2006-05-26 20:47:00
|
Hi everyone, I have just installed systray-0.6.1.win32.exe on my PythonWin 2.3.3. I downloaded pysystray-sample-0.6.1.zip, unzipped it and tried running sample.py. I am getting this error: [/cygdrive/c/design/Miscellaneous/ Taskbar/pysystray-sample-0.6.1]: python sample.py File "sample.py", line 17 @systray.threaded ^ SyntaxError: invalid syntax When I comment this line out and instead insert the line systray.threaded, I get this error: [/cygdrive/c/design/Miscellaneous/Taskbar/ pysystray-sample-0.6.1]: python sample.py Traceback (most recent call last): File "sample.py", line 2, in ? from systray import systray File "C:\Python23\Lib\site-packages\systray\systray.py", line 13, in ? import bases File "C:\Python23\lib\site-packages\systray\bases.py", line 173 @utils.threaded Can you please let me know what I am doing wrong. Thanks, Sajjad __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Alec B. <wry...@gm...> - 2006-03-17 23:31:09
|
I really like Pysystray, made it incredibly easy for me to do the system tray part of my app. I was wondering if anyone knows of any other gui packages out there that make other gui tasks similarly easy? Specifically I'd like something that would make editing an INI file happen through a gui, and something that would pipe the output to the console window to a gui window. And if you'd like, have a look at my new app, Useless Keys. Lets you use th= e "useless keys" (scroll lock, pause, etc.) on the keyboard to launch applications. "The multimedia keyboard for the rest of us". |
From: Alec B. <wry...@gm...> - 2006-03-13 00:13:48
|
Nevermind, I think I isolated the problem to pyhooks. For some reason it isn't working compiled to exe, but pysystray is working fine. On 3/12/06, Alec Bennett <wry...@gm...> wrote: > > It is possible. BitTorrent 4.4 is compiled with py2exe and includes > > pysystray. You should download the BitTorrent 4.4 source code and > > look at our build scripts. > > > > http://www.bittorrent.com/dl/?C=3DM;O=3DD > > > Would it be possible to give me a hint where to look? Looking at gui.pyan= d > trayicon.py I'm not finding anything. > > Sorry if it's obvious, I'm pretty new to this. > > > > |
From: Alec B. <wry...@gm...> - 2006-03-12 11:11:04
|
> > It is possible. BitTorrent 4.4 is compiled with py2exe and includes > pysystray. You should download the BitTorrent 4.4 source code and > look at our build scripts. > > http://www.bittorrent.com/dl/?C=3DM;O=3DD Would it be possible to give me a hint where to look? Looking at gui.py and trayicon.py I'm not finding anything. Sorry if it's obvious, I'm pretty new to this. |
From: Matt C. <mat...@bi...> - 2006-03-01 16:30:19
|
It is possible. BitTorrent 4.4 is compiled with py2exe and includes pysystray. You should download the BitTorrent 4.4 source code and look at our build scripts. http://www.bittorrent.com/dl/?C=M;O=D matt On Mar 1 2006, 04:31, Alec Bennett wrote: >I'm wondering if it's possible to compile applications built with pysystray to >exe? I tried compiling with both pyinstaller and py2exe, and both produce >executables that don't respond to mouse clicks in the system tray. > >Thanks for any help. > >(Or maybe there's some other way to accomplish this: I want to be able to give >the apps to people who don't have Python installed). > > |
From: Essien I. E. <es...@sp...> - 2006-03-01 12:46:03
|
Hiya, I've not tried to do this myself before, but now that you mention it, I'll try and see what kind of problems I encounter. Cheers, Essien Ita Essien http://essiene.blogspot.com <http://essiene.blogspot.com/> http://datavibe.net/~essiene http://datavibe.net/~essiene/pysystray ...the future is open .Linux is open.is this a coincidence? _____ From: pys...@li... [mailto:pys...@li...] On Behalf Of Alec Bennett Sent: Wednesday, March 01, 2006 1:31 PM To: pys...@li... Subject: SPAM-LOW: [pysystray-users] possible to compile to exe? I'm wondering if it's possible to compile applications built with pysystray to exe? I tried compiling with both pyinstaller and py2exe, and both produce executables that don't respond to mouse clicks in the system tray. Thanks for any help. (Or maybe there's some other way to accomplish this: I want to be able to give the apps to people who don't have Python installed). |
From: Alec B. <wry...@gm...> - 2006-03-01 12:31:30
|
I'm wondering if it's possible to compile applications built with pysystray to exe? I tried compiling with both pyinstaller and py2exe, and both produc= e executables that don't respond to mouse clicks in the system tray. Thanks for any help. (Or maybe there's some other way to accomplish this: I want to be able to give the apps to people who don't have Python installed). |
From: Essien I. E. <es...@sp...> - 2005-12-20 10:56:54
|
Applied. Thnx. [Was slow to reply b/cos... Dem 'Olidayes... Dem Is A Com'n!!! :D] Essien Ita Essien ----------------------------- http://essiene.blogspot.com http://datavibe.net/~essiene http://datavibe.net/~essiene/pysystray ---------------------------------------------- ...the future is open. -----Original Message----- From: pys...@li... [mailto:pys...@li...] On Behalf Of Greg Hazel Sent: Saturday, December 17, 2005 12:23 AM To: pys...@li... Subject: [pysystray-users] explorer restart bugfix This patch fixes a bug which prevented the icon from re-appearing in the systray when explorer was restarted. -Greg |
From: Greg H. <gr...@bi...> - 2005-12-16 23:22:36
|
This patch fixes a bug which prevented the icon from re-appearing in the systray when explorer was restarted. -Greg |
From: Essien I. E. <es...@sp...> - 2005-12-13 11:52:46
|
Applied patch to your patch :) Thnx Essien Ita Essien ----------------------------- http://essiene.blogspot.com http://datavibe.net/~essiene http://datavibe.net/~essiene/pysystray ---------------------------------------------- ...the future is open. -----Original Message----- From: pys...@li... [mailto:pys...@li...] On Behalf Of Greg Hazel Sent: Monday, December 12, 2005 1:00 AM To: pys...@li... Subject: SPAM-LOW: Re: [pysystray-users] LoadImage memory leak (patch included) For some reason, after a running for a few days, the systray icon has a small chance of going the default white-with-blue-top default icon. My guess is the loaded_icon trick I included in this patch causes that. Reloading the icon every second isn't terribly cpu intensive, so I've taken that part out for now. The diff is attached. -Greg On 12/9/05, Essien Ita Essien <es...@sp...> wrote: > Applied. Thnx. > > Essien Ita Essien > ----------------------------- > http://essiene.blogspot.com > http://datavibe.net/~essiene > http://datavibe.net/~essiene/pysystray > ---------------------------------------------- > ...the future is open. > > -----Original Message----- > From: pys...@li... > [mailto:pys...@li...] On Behalf Of Greg Hazel > Sent: Friday, December 09, 2005 8:30 AM > To: pys...@li... > Subject: SPAM-LOW: [pysystray-users] LoadImage memory leak (patch included) > > This patch addresses a bug I found. > The memory allocated with LoadImage was not being destroyed when a new > icon was created. We change the tooltip text frequently, and after > about 1000 updates (which call refresh_icon) there's so little > resources left that the main gui crashes. > I added some code to only reallocate if it needs to, and to clean up > if it had previously allocated. Also, I changed LR_DEFAULTSIZE to > 16x16, since the wrong image was being pulled (and resized) from our > multi-format icon. That last part is independent of the bugfix, but I > recommend it. > > -Greg > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > _______________________________________________ > pysystray-users mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysystray-users > |