I am happy to announce the release of my latest child, RibbonBar.
This is a pure-Python translation of the very nice (and very nicely
written, in a C++ perspective) wxRibbon from Peter Cawley and his
Google Summer of Code 2009.
As many of you know, the RibbonBar library is a set of classes for
writing a ribbon user interface. At the most generic level, this is a
combination of a tab control with a toolbar. At a more functional
level, it is similar to the user interface present in recent versions
of Microsoft Office.
========
= NOTE =
========
The Python version of the RibbonBar has still a problem in correctly
resizing when used in a *VERTICAL* mode. I wasn't able to crash this
bug, and you can see it by comparing the RibbonBar Python demo (in a
vertical mode) with the nice screenshots on Peter's blog here:
http://www.corsix.org/content/ribbon-summer-code
Any help in fixing this issue would be more than welcome.
=========
END NOTE
=========
Now, source code, demo and other screenshots are on my website:
http://xoomer.virgilio.it/infinity77/main/freeware.html#ribbonbar
Or:
http://xoomer.alice.it/infinity77/main/freeware.html#ribbonbar
If you find a bug, please do make and effort and try to create a patch
for it. I tested it only on Windows, and I have absolutely no idea if
it works on GTK or Mac. Any help in fixing bugs appearing on these 2
platforms is more than welcome.
Enjoy, wxPython rules :-D
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/
> Hi All,
>
> I am happy to announce the release of my latest child, RibbonBar.
> This is a pure-Python translation of the very nice (and very nicely
> written, in a C++ perspective) wxRibbon from Peter Cawley and his
> Google Summer of Code 2009.
Thanks for this widget, it's incredible what you are pulling off!
I'm in the process of integrating it into my own application (which by now
looks more like wxAGW than wxPython :D). My old toolbar was always too
big, so RibbonBar is a perfect replacement. The old toolbar had tooltips
which popped up when you moved the cursor over a button. When adding a
button to the new RibbonBar I can specify the tooltip string, but a
tooltip never pops up. I've looked into the source and there doesn't seem
to be any code to handle tooltips. I've also looked at the tooltips in ms
word and they look very much like your SuperToolTip widget.
My question is now how do I go best about adding tooltips to RibbonBar?
Should it raise some kind of "show tooltip" event which the user can
handle (e.g. by using a SuperToolTip)? Or is there a better way? I'm also
afraid to desync your version of RibbonBar from the C++ version, what's
your policy regarding that?
-Matthias
2009/10/19 Nitro:
>
> Am 16.10.2009, 11:50 Uhr, schrieb Andrea Gavana <andrea...@gmail.com>:
>
>> Hi All,
>>
>> I am happy to announce the release of my latest child, RibbonBar.
>> This is a pure-Python translation of the very nice (and very nicely
>> written, in a C++ perspective) wxRibbon from Peter Cawley and his
>> Google Summer of Code 2009.
>
> Thanks for this widget, it's incredible what you are pulling off!
It's just my personal way to say "thank you" to wxPython itself. Much
of the praises I had in the last 4 years in my job are mostly due to
the power of wxPython, and secondarily to my still limited skills. The
trouble is, I haven't got any new ideas for new widgets. I am actually
playing with a pure-Python version of a Mac-like Dock (or BubbleBar,
or FishEye menu or whatever you like), but it's just an eye-catching
small thing. I am always open to suggestions :-D
> I'm in the process of integrating it into my own application (which by now
> looks more like wxAGW than wxPython :D). My old toolbar was always too
> big, so RibbonBar is a perfect replacement. The old toolbar had tooltips
> which popped up when you moved the cursor over a button. When adding a
> button to the new RibbonBar I can specify the tooltip string, but a
> tooltip never pops up. I've looked into the source and there doesn't seem
> to be any code to handle tooltips. I've also looked at the tooltips in ms
> word and they look very much like your SuperToolTip widget.
>
> My question is now how do I go best about adding tooltips to RibbonBar?
> Should it raise some kind of "show tooltip" event which the user can
> handle (e.g. by using a SuperToolTip)? Or is there a better way? I'm also
> afraid to desync your version of RibbonBar from the C++ version, what's
> your policy regarding that?
As it stands, the Ribbon is missing 4 or 5 important features (in my
opinion), in this order of importance:
1) Buttons can be normal buttons, dropdown or hybrid: there is still
no way to make them behave as check or radio buttons (the Office
RibbonBar has this feature);
2) Toolbar buttons have no ability to behave as check or radio buttons;
3) There is no way to add a control inside a RibbonBar (like a
checkbox or a small listbox);
4) The RibbonBar in vertical mode is still buggy;
5) There is no "Orb" at the top left of the Ribbon.
To answer your question, I don't think we should worry about desyncing
the Python version from the C++ one: I believe that, if the Python
version is used and maintained and developed, it will probably end up
inside wx.lib.agw (as AUI did) and it will live its own independent
life. We may add features as much as we want without waiting for the
C++ guys to approve them.
So there might be a couple of ways to do what you propose:
1) Implement a simple self.SetTooltipString("help_string") when the
mouse is over a button in buttonbar.py;
2) Send a EVT_RIBBONBUTTONBAR_TOOLTIP when the mouse is over a button
in buttonbar.py (including the button rect in the event) and then it's
up to the developer to catch the event and display whatever tooltip
he/she likes. I developed SuperToolTip because it looked so much like
the Ribbon tooltip that I imagined sooner or later we would have
needed it.
Please feel free to hack the source: if you come up with a patch,
please contribute it back and I will update the RibbonBar version on
my website. I do have a couple of questions though:
1) You mentioned that:
"""
I'm in the process of integrating it into my own application (which by now
looks more like wxAGW than wxPython :D)
"""
Would it be possible for you to send me a screenshot of your app? I am
just curious.
2) Have you tested the Ribbon on other platforms than MSW? Does it work there?
Something that comes to mind is pie menus: http://www.piemenus.com/. (I
once had a chance to play with them under Sun's NeWS back in the '80s,
and I have easyGestures installed on Firefox.)
--
Don Dwiggins
Advanced Publishing Technology
I am trying to add a right click popupmenu for user of my app, which will have options to either delete a button, or panel or an entire page. I looked into the codes and I am not able to find any function that deletes page or panel. It would be a great help if you could give me an idea on how to do the deleting part.
Dear Metallicow,Thanks a lot for your reply and sorry for not attaching the code. I have successfully bounded the wx.EVT_RIGHT_UP and wx.EVT_CONTEXT_MENU without any problem. The problem I have is when user clicks on "Remove Tab" in wxpython, I have to remove that Ribbon Page which user wants to remove from being displayed. I have attached a major portion of my code and the place where I am having problem is the definition of 2 functions, namely : "RemoveTab(self,event)" and "RemoveGroupBox(self, event)" where GroupBox is the panel in any ribbon page.Thanks a lot for your help.Samyak
Dear Metallicow,
I was successful in implementing the above without any problem. I have attached my code if anyone need that.
Actually, I needed another help from Andrea or you regarding wxribbon. I am trying to implement an 'Orb', dropdown button on the top left corner of ribbon near the first tab just like in MS Office. But, I have no idea how to implement that. If would be really helpful if anyone could give me any idea on how to do it. Thanks a lot.
# Close the current selected Tab in Ribbon
def RemoveTab(self, event, index, page):
if len(self._ribbon._pages) > 1 and index != 0:
#page = self._ribbon._pages[n].page
if index > 0 :
activepage = self._ribbon._pages[index-1].page
self._ribbon.SetActivePage(activepage)
else:
activepage = self._ribbon._pages[len(self._ribbon._pages) - 1].page
self._ribbon.SetActivePage(activepage)
for child in page.GetChildren():
page.RemoveChild(child)
self._ribbon._pages.pop(index)
self._ribbon.Realize()
else :
wx.MessageBox('This tab must be opened.', 'Info', wx.OK | wx.ICON_INFORMATION)
# PopupMenu Event
def OnRemoveTab(self, event):
actPageIdx = self._ribbon.GetActivePage()
print('actPageIdx', actPageIdx)
pg = self._ribbon._pages[actPageIdx].page
print('page', pg)
self.DoRemoveTab(index=actPageIdx, page=pg)
# Close the current selected Tab in Ribbon
def DoRemoveTab(self, index, page):
if len(self._ribbon._pages) > 1 and index != 0:
#page = self._ribbon._pages[n].page
if index > 0 :
activepage = self._ribbon._pages[index-1].page
self._ribbon.SetActivePage(activepage)
else:
activepage = self._ribbon._pages[len(self._ribbon._pages) - 1].page
self._ribbon.SetActivePage(activepage)
for child in page.GetChildren():
page.RemoveChild(child)
self._ribbon._pages.pop(index)
self._ribbon.Realize()
else :
wx.MessageBox('This tab must be opened.', 'Info', wx.OK | wx.ICON_INFORMATION)
self._ribbon.SendSizeEvent() # Force Update/Refresh
self._ribbon = RB.RibbonBar(self, wx.ID_ANY, size = (1368,350), style = RB.RIBBON_BAR_DEFAULT_STYLE | RB.RIBBON_BAR_ALWAYS_SHOW_TABS)
workpiece = RB.RibbonPage(self._ribbon, WORKPIECE, "Workpiece", Bitmap("eye.xpm"))
panel1 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))
panel2 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))
panel3 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))Dear Metallicow,
Thanks a lot for your reply. I am able to make a dropdown button on left of the first tab without any problem by making the button a child of wxribbon and giving it a fixed position on the GUI.
What I am trying to achieve now is to allow users to be able to drag panels on a page to reorder them according to their need. I am a newbie and I have no idea how to do it. I just need some as guidance as to how to do this. Any help would be great. Thanks. I have attached a simple ribbon code with panels.self._ribbon = RB.RibbonBar(self, wx.ID_ANY, size = (1368,350), style = RB.RIBBON_BAR_DEFAULT_STYLE | RB.RIBBON_BAR_ALWAYS_SHOW_TABS) workpiece = RB.RibbonPage(self._ribbon, WORKPIECE, "Workpiece", Bitmap("eye.xpm")) panel1 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm")) panel2 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm")) panel3 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))