Ejemplo n.º 1
0
 Glib::RefPtr<Gtk::Action> ActionManager::find_action_by_name(const std::string & n) const
 {
   Glib::ListHandle<Glib::RefPtr<Gtk::ActionGroup> > actiongroups = m_ui->get_action_groups();
   for(Glib::ListHandle<Glib::RefPtr<Gtk::ActionGroup> >::const_iterator iter(actiongroups.begin()); 
       iter != actiongroups.end(); ++iter) {
     Glib::ListHandle<Glib::RefPtr<Gtk::Action> > actions = (*iter)->get_actions();
     for(Glib::ListHandle<Glib::RefPtr<Gtk::Action> >::const_iterator iter2(actions.begin()); 
         iter2 != actions.end(); ++iter2) {
       if((*iter2)->get_name() == n) {
         return *iter2;
       }
     }
   }
   DBG_OUT("%s not found", n.c_str());
   return Glib::RefPtr<Gtk::Action>();      
 }
Ejemplo n.º 2
0
/** Constructor.
 * @param cobject C base object
 * @param builder instance to retrieve widgets from
 */
HybrisMonitorGtkWindow::HybrisMonitorGtkWindow(BaseObjectType* cobject,
					       const Glib::RefPtr<Gtk::Builder> &builder)
  : Gtk::Window(cobject), ros_nh_()
{
  set_wmclass("Hybris Robot Monitor", "Hybris Robot Monitor");

#ifdef HAVE_GCONFMM
  gconf_ = Gnome::Conf::Client::get_default_client();
  gconf_->add_dir(GCONF_PREFIX);
#endif

  builder->get_widget("lab_agent_now", lab_agent_now_);
  builder->get_widget("lab_agent_before", lab_agent_before_);
  builder->get_widget("lab_skill", lab_skill_);
  builder->get_widget("trv_plan", trv_plan_);
  builder->get_widget("window_plan", window_plan_);
  builder->get_widget("lab_plan_status", lab_plan_status_);

  plan_list_ = Gtk::ListStore::create(plan_record_);
  trv_plan_->set_model(plan_list_);
  trv_plan_->append_column("Step", plan_record_.step);
  trv_plan_->get_selection()->set_mode(Gtk::SELECTION_NONE);

  Glib::ListHandle<Gtk::TreeViewColumn *> columns = trv_plan_->get_columns();
  for (Glib::ListHandle<Gtk::TreeViewColumn *>::iterator c = columns.begin();
       c != columns.end();
       ++c)
  {
#if GTK_VERSION_GE(3,0)
    Gtk::CellRenderer *cell_renderer = (*c)->get_first_cell();
#else
    Gtk::CellRenderer *cell_renderer = (*c)->get_first_cell_renderer();
#endif
    Gtk::CellRendererText *text_renderer =
      dynamic_cast<Gtk::CellRendererText *>(cell_renderer);
    if ( text_renderer ) {
      Pango::AttrList  attr_list;
      Pango::Attribute scale_attr = Pango::Attribute::create_attr_scale(1.25);
      attr_list.insert(scale_attr);
      text_renderer->property_attributes().set_value(attr_list);
#ifdef GLIBMM_PROPERTIES_ENABLED
      (*c)->add_attribute(text_renderer->property_background_gdk(), plan_record_.background);
      (*c)->add_attribute(text_renderer->property_foreground_gdk(), plan_record_.foreground);
#else
      (*c)->add_attribute(*text_renderer, "background-gdk", plan_record_.background);
      (*c)->add_attribute(*text_renderer, "foreground-gdk", plan_record_.background);
#endif
    }
  }

  //graph_changed.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_graph_changed));

  dsp_planner_status_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_planner_status_cb));
  sub_planner_status_ = ros_nh_.subscribe("continual_planning_status", 10,
					  &HybrisMonitorGtkWindow::planner_status_cb, this);

  dsp_skiller_status_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_skiller_status_cb));
  sub_skiller_status_ = ros_nh_.subscribe("skiller_status", 10,
					  &HybrisMonitorGtkWindow::skiller_status_cb, this);

  dsp_agent_info_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_agent_info_cb));
  sub_agent_info_ = ros_nh_.subscribe("agent_info", 10,
					  &HybrisMonitorGtkWindow::agent_info_cb, this);

#ifdef HAVE_GCONFMM
  gconf_->signal_value_changed().connect(
    sigc::hide(sigc::hide(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_config_changed))));
  on_config_changed();
#endif
}