AGW - toolbar AddTool

I assign items to the toolbar like this:

             tb.AddTool(b[1], b[2], bmp, disabled_bitmap=wx.NullBitmap,
                     kind=b[7],
                     short_help_string=b[4], long_help_string=b[4],
                     client_data=None, target=None)

Works on Windows but on Ubuntu I see this exception:

  File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 63, in __init__
     tb = self.doMainTB(self._mgr, self)
   File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 149, in doMainTB
     uiutils.doCreateToolbarItems(self, mainTB, tools)
   File "/home/wbruhin/devTools/medialocker/mlsrc/libui/uiutils.py", line 207, in doCreateToolbarItems
     client_data=None, target=None)
TypeError: AddTool() got an unexpected keyword argument 'target'

So, as I don't use them I just remove them, but that doesn't work on Windows nor on *nix, I get this exception on Windows:

   File "F:\devProjectsT\MikeD\MediaLockerTemp\mlsrc\mediaLocker.py", line 149, in doMainTB
     uiutils.doCreateToolbarItems(self, mainTB, tools)
   File "F:\devProjectsT\MikeD\MediaLockerTemp\mlsrc\libui\uiutils.py", line 206, in doCreateToolbarItems
     short_help_string=b[4], long_help_string=b[4])
TypeError: AddTool() takes exactly 10 arguments (8 given)

And this on Windows:
     tb = self.doMainTB(self._mgr, self)
   File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 149, in doMainTB
     uiutils.doCreateToolbarItems(self, mainTB, tools)
   File "/home/wbruhin/devTools/medialocker/mlsrc/libui/uiutils.py", line 206, in doCreateToolbarItems
     short_help_string=b[4], long_help_string=b[4])
TypeError: AddTool() takes exactly 9 non-keyword arguments (8 given)

Looking at aui.auibar.Add* methods I see that they are not very consistent, sometimes keyword, sometimes not.

What would be a good way to fix this up? Would keywords everywhere be o.k.?

Werner

Hi Werner,

I assign items to the toolbar like this:

       tb\.AddTool\(b\[1\], b\[2\], bmp, disabled\_bitmap=wx\.NullBitmap,
               kind=b\[7\],
               short\_help\_string=b\[4\], long\_help\_string=b\[4\],
               client\_data=None, target=None\)

Works on Windows but on Ubuntu I see this exception:

File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 63, in
__init__
tb = self.doMainTB(self._mgr, self)
File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 149,
in doMainTB
uiutils.doCreateToolbarItems(self, mainTB, tools)
File "/home/wbruhin/devTools/medialocker/mlsrc/libui/uiutils.py", line 207,
in doCreateToolbarItems
client_data=None, target=None)
TypeError: AddTool() got an unexpected keyword argument 'target'

Are you sure you are using the same SVN version of AGW on both platforms?

So, as I don't use them I just remove them, but that doesn't work on Windows
nor on *nix, I get this exception on Windows:

File "F:\devProjectsT\MikeD\MediaLockerTemp\mlsrc\mediaLocker.py", line
149, in doMainTB
uiutils.doCreateToolbarItems(self, mainTB, tools)
File "F:\devProjectsT\MikeD\MediaLockerTemp\mlsrc\libui\uiutils.py", line
206, in doCreateToolbarItems
short_help_string=b[4], long_help_string=b[4])
TypeError: AddTool() takes exactly 10 arguments (8 given)

And this on Windows:
tb = self.doMainTB(self._mgr, self)
File "/home/wbruhin/devTools/medialocker/mlsrc/mediaLocker.py", line 149,
in doMainTB
uiutils.doCreateToolbarItems(self, mainTB, tools)
File "/home/wbruhin/devTools/medialocker/mlsrc/libui/uiutils.py", line 206,
in doCreateToolbarItems
short_help_string=b[4], long_help_string=b[4])
TypeError: AddTool() takes exactly 9 non-keyword arguments (8 given)

Looking at aui.auibar.Add* methods I see that they are not very consistent,
sometimes keyword, sometimes not.

What would be a good way to fix this up? Would keywords everywhere be o.k.?

I think I have fixed it in SVN, could you try it and see if it works?

Thank you.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 11 December 2011 09:49, werner <wbruhin@free.fr> wrote:

Hi Andrea,

...

Are you sure you are using the same SVN version of AGW on both platforms?

On Ubuntu it is the 2.9.2.4 version and on Win a recent SVN copy, sorry should have mentioned that.

...

What would be an AddTool call signature which is compatible with agw 2.8x? Would like to use that for MediaLocker to prevent another SVN dependency.

I think I have fixed it in SVN, could you try it and see if it works?

With or without the last two keywords works for me on Windows, will check it out on *nix a bit later.

Thanks
Werner

···

On 12/11/2011 10:15 AM, Andrea Gavana wrote:

Hi Andrea,

...

What would be an AddTool call signature which is compatible with agw 2.8x? Would like to use that for MediaLocker to prevent another SVN dependency.

Never mind, I went with AddSimpleTool which seems to do the trick for now.

Werner

···

On 12/11/2011 10:47 AM, werner wrote: