def _init_toolbar(self):
     '''A Toolbar is created with an ActionBar widget in which buttons are
        added with a specific behavior given by a callback. The buttons
        properties are given by matplotlib.
     '''
     basedir = os.path.join(rcParams['datapath'], 'images')
     actionview = ActionView()
     actionprevious = ActionPrevious(title="Navigation",
                                     with_previous=False)
     actionoverflow = ActionOverflow()
     actionview.add_widget(actionprevious)
     actionview.add_widget(actionoverflow)
     actionview.use_separator = True
     self.actionbar.add_widget(actionview)
     id_group = uuid.uuid4()
     for text, tooltip_text, image_file, callback in self.toolitems:
         if text is None:
             actionview.add_widget(ActionSeparator())
             continue
         fname = os.path.join(basedir, image_file + '.png')
         if text in ['Pan', 'Zoom']:
             action_button = ActionToggleButton(text=text,
                                                icon=fname,
                                                group=id_group)
         else:
             action_button = ActionButton(text=text, icon=fname)
         action_button.bind(on_press=getattr(self, callback))
         actionview.add_widget(action_button)
예제 #2
0
def test_plugin(interval):
    action_view = app.start_screen.action_view
    item_button = \
        ActionButton(id='plugins', on_press=events_screen,
                     icon='{}/Libs/Plugins/TestPlugin/button.png'.format(
                         app.directory))
    action_view.add_widget(item_button, index=-1)
    action_view.add_widget(ActionSeparator(), index=-1)
예제 #3
0
 def setup_user_chooser(self, caro):
     caro.actionBar.action_view.width = Window.width
     self.user_chooser = UserChooser(**user_chooser_properties)
     caro.actionBar.action_view.add_widget(ActionSeparator(**separators_properties))
     caro.actionBar.action_view.add_widget(self.user_chooser)
     caro.actionBar.action_view._layout_random()