wx.Notebook() hierarchy?

My Web searches did not find answers to the question of whether notebook
tabs can have sub-tabs. Example: a tab for "Data" would have sub-tabs for
"Biota", "Chemical", "Physical", etc.

   If this is not possible or practical, what alternative organizational
structure would allow for groups and sub-groups? Perhaps a tree list?

Rich

Found the answers: Yes, a notebook can have sub-tabs and the wx.Treebook()
does the job cleanly and efficiently.

Rich

···

On Tue, 15 Jul 2014, Rich Shepard wrote:

My Web searches did not find answers to the question of whether notebook
tabs can have sub-tabs. Example: a tab for "Data" would have sub-tabs for
"Biota", "Chemical", "Physical", etc.

If this is not possible or practical, what alternative organizational
structure would allow for groups and sub-groups? Perhaps a tree list?

Notebook’s just accept panels for the tabs, those panels can contain whatever, even a Notebook. Unless you want drop-down menus popping up from the tabs, I don’t know if that is possible, but it likely is with some custom code that would create a PopupMenu on the Eevent wx.EVT_NOTEBOOK_PAGE_CHANGING.

···

On Tuesday, July 15, 2014 9:44:19 AM UTC-7, fuzzydoc wrote:

On Tue, 15 Jul 2014, Rich Shepard wrote:

My Web searches did not find answers to the question of whether notebook

tabs can have sub-tabs. Example: a tab for “Data” would have sub-tabs for

“Biota”, “Chemical”, “Physical”, etc.

If this is not possible or practical, what alternative organizational

structure would allow for groups and sub-groups? Perhaps a tree list?

Found the answers: Yes, a notebook can have sub-tabs and the wx.Treebook()

does the job cleanly and efficiently.

Rich

If you want a pop-up instead of tabs, then try the Choicebook.

  • Mike
···

On Tuesday, July 15, 2014 1:26:55 PM UTC-5, Nathan McCorkle wrote:

Notebook’s just accept panels for the tabs, those panels can contain whatever, even a Notebook. Unless you want drop-down menus popping up from the tabs, I don’t know if that is possible, but it likely is with some custom code that would create a PopupMenu on the Eevent wx.EVT_NOTEBOOK_PAGE_CHANGING.

Nathan,

   I decided that it is cleaner to use the Treebook with the menus on the
left and the panels on the right. This lets me group related pages (e.g.,
organization, branch, contacts) as tabs for the Organization menu item. I
suppose, however, that I can do the same thing within the regular Notebook
class.

   It's going to be complicated regardless of the book widget used. I need
different panels based on user role, unless I can de-activate specific
widgets or events based on those roles. All of this, of course, is new to
me so it'll take quite some time.

   I'm always open to suggestions.

Thanks,

Rich

···

On Tue, 15 Jul 2014, Nathan McCorkle wrote:

Notebook's just accept panels for the tabs, those panels can contain
whatever, even a Notebook. Unless you want drop-down menus popping up from
the tabs, I don't know if that is possible, but it likely is with some
custom code that would create a PopupMenu on the Eevent wx.
EVT_NOTEBOOK_PAGE_CHANGING.

Mike,

   I looked at those. There are many available choices (no pun intended) and
I've no idea what might be the easiest for users.

Thanks,

Rich

···

On Tue, 15 Jul 2014, Mike Driscoll wrote:

If you want a pop-up instead of tabs, then try the Choicebook.

Ah, I was actually thinking more along the lines of a widget like these:

···

On Tuesday, July 15, 2014 11:37:05 AM UTC-7, Mike Driscoll wrote:

If you want a pop-up instead of tabs, then try the Choicebook.

You can just add a level 2 notebook as a page to a level 1 notebook.

···

On Tue, Jul 15, 2014 at 12:20 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

  My Web searches did not find answers to the question of whether notebook
tabs can have sub-tabs. Example: a tab for "Data" would have sub-tabs for
"Biota", "Chemical", "Physical", etc.

  If this is not possible or practical, what alternative organizational
structure would allow for groups and sub-groups? Perhaps a tree list?

Rich

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Best Regards,
Michael Moriarity

...

  It's going to be complicated regardless of the book widget used. I need
different panels based on user role, unless I can de-activate specific
widgets or events based on those roles. All of this, of course, is new to
me so it'll take quite some time.

  I'm always open to suggestions.

You might want to look into wx.EVT_UPDATE_UI, I use it to activate/deactive buttons and to change panels depending on a flag.

e.g. for a toolbar.save botton:
         self.view.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIsave,
                        id=self.save)

     def onUpdateUIsave(self, evt):
         """save button state"""
         if self.dataIsDirty:
             evt.Enable(True)
         else:
             evt.Enable(False)

Keep the handler as short as possible and be careful if you change other things then the Enable state.

http://wxpython.org/Phoenix/docs/html/UpdateUIEvent.html

Werner

···

On 7/15/2014 20:42, Rich Shepard wrote:

Werner,

   Thank you. The description addresses buttons and menus, yet if it will
change panels based on other triggers (such as a user's role) it would be
a great time-saver.

Rich

···

On Wed, 16 Jul 2014, Werner wrote:

You might want to look into wx.EVT_UPDATE_UI, I use it to activate/deactive buttons and to change panels depending on a flag.

e.g. for a toolbar.save botton:
       self.view.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIsave,
                      id=self.save)

   def onUpdateUIsave(self, evt):
       """save button state"""
       if self.dataIsDirty:
           evt.Enable(True)
       else:
           evt.Enable(False)

Keep the handler as short as possible and be careful if you change other things then the Enable state.

http://wxpython.org/Phoenix/docs/html/UpdateUIEvent.html

Hi Rich,

You might want to look into wx.EVT_UPDATE_UI, I use it to activate/deactive buttons and to change panels depending on a flag.

e.g. for a toolbar.save botton:
       self.view.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIsave,
                      id=self.save)

   def onUpdateUIsave(self, evt):
       """save button state"""
       if self.dataIsDirty:
           evt.Enable(True)
       else:
           evt.Enable(False)

Keep the handler as short as possible and be careful if you change other things then the Enable state.

http://wxpython.org/Phoenix/docs/html/UpdateUIEvent.html

Werner,

  Thank you. The description addresses buttons and menus, yet if it will
change panels based on other triggers (such as a user's role) it would be
a great time-saver.

I use it in one case to switch out panes with different content:

         self.view.paneDrinkW.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIdrinkW)
         self.view.paneDrinkSp.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIdrinkSp)

     def onUpdateUIdrinkW(self, evt):
         """drink pane - wine state"""
         if self.dbItem:
             if self._drinkType == u"SPIRIT":
                 evt.Enable(False)
                 evt.Show(False)
             else:
                 evt.Enable(True)
                 evt.Show(True)

     def onUpdateUIdrinkSp(self, evt):
         """drink pane - spirit state"""
         if self.dbItem:
             if self._drinkType == u"SPIRIT":
                 evt.Enable(True)
                 evt.Show(True)
             else:
                 evt.Enable(False)
                 evt.Show(False)

Werner

···

On 7/16/2014 17:45, Rich Shepard wrote:

On Wed, 16 Jul 2014, Werner wrote:

I'm not sure which is better to suggest...I guess it depends on how
different the panel will be based on user's role. If it is wildly
different, probably a totally different panel. If it is only a bit
different, then you could just have a list of the objects to be
deactivated, store these lists in a dictionary, and when you determine user
role, call a function called something like

    self.toggleWidgetsPerUserRole(role)

and in that function you could do:

    widget_list_to_be_deactivated_list =
self.widgets_deactivated_per_role_dict[role]
    for widget in widgets_to_be_deactivated_list:
         widget.Deactivate()

And then the appropriate widgets would be deactivated. You'd have to also
do something about activating those that should be activated, so this is in
itself not covering that, just trying to give you some idea.

···

On Tue, Jul 15, 2014 at 2:42 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

It's going to be complicated regardless of the book widget used. I need
different panels based on user role, unless I can de-activate specific
widgets or events based on those roles. All of this, of course, is new to
me so it'll take quite some time.

  I'm always open to suggestions.

Werner,

   I'll drink to that! Thanks very much.

Rich

···

On Wed, 16 Jul 2014, Werner wrote:

I use it in one case to switch out panes with different content:

       self.view.paneDrinkW.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIdrinkW)
       self.view.paneDrinkSp.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIdrinkSp)

   def onUpdateUIdrinkW(self, evt):
       """drink pane - wine state"""
       if self.dbItem:
           if self._drinkType == u"SPIRIT":
               evt.Enable(False)
               evt.Show(False)
           else:
               evt.Enable(True)
               evt.Show(True)

   def onUpdateUIdrinkSp(self, evt):
       """drink pane - spirit state"""
       if self.dbItem:
           if self._drinkType == u"SPIRIT":
               evt.Enable(True)
               evt.Show(True)
           else:
               evt.Enable(False)
               evt.Show(False)

Che,

   My current focus is writing the panels for data entry and modification;
about 35 in all. For some, button/function deactivation would be appropriate
(e.g., a technician can enter data but not change it once it's been written
to the database table; changes require a manager for audit trail purposes),
for other cases a different form would be appropriate (e.g., a user does not
need to see the details of usage that a manager or admin would want to see.)

Thanks for the suggestions,

Rich

···

On Wed, 16 Jul 2014, C M wrote:

I'm not sure which is better to suggest...I guess it depends on how
different the panel will be based on user's role. If it is wildly
different, probably a totally different panel. If it is only a bit
different, then you could just have a list of the objects to be
deactivated, store these lists in a dictionary, and when you determine
user role, call a function called something like

   self.toggleWidgetsPerUserRole(role)

and in that function you could do:

   widget_list_to_be_deactivated_list =
self.widgets_deactivated_per_role_dict[role]
   for widget in widgets_to_be_deactivated_list:
        widget.Deactivate()

And then the appropriate widgets would be deactivated. You'd have to also
do something about activating those that should be activated, so this is in
itself not covering that, just trying to give you some idea.