23 #include "liaison_scope.h" 25 #include <Wt/Chart/WCartesianChart> 27 #include <Wt/WApplication> 28 #include <Wt/WDateTime> 29 #include <Wt/WLineEdit> 31 #include <Wt/WPushButton> 32 #include <Wt/WSelectionBox> 33 #include <Wt/WSortFilterProxyModel> 34 #include <Wt/WStandardItem> 35 #include <Wt/WStringListModel> 37 #include <Wt/WTextArea> 39 #include <Wt/WVBoxLayout> 41 #include <boost/algorithm/string/regex.hpp> 42 #include <boost/regex.hpp> 50 goby::common::LiaisonScope::LiaisonScope(ZeroMQService* zeromq_service,
51 const protobuf::LiaisonConfig& cfg,
52 Wt::WContainerWidget* parent)
53 : LiaisonContainer(parent), MOOSNode(zeromq_service), zeromq_service_(zeromq_service),
54 moos_scope_config_(cfg.GetExtension(protobuf::moos_scope_config)),
55 history_model_(new
Wt::WStringListModel(this)),
56 model_(new LiaisonScopeMOOSModel(moos_scope_config_, this)),
57 proxy_(new
Wt::WSortFilterProxyModel(this)), main_layout_(new
Wt::WVBoxLayout(this)),
58 last_scope_state_(UNKNOWN),
59 subscriptions_div_(new SubscriptionsContainer(this, model_, history_model_, msg_map_)),
61 new HistoryContainer(this, main_layout_, history_model_, moos_scope_config_)),
62 controls_div_(new ControlsContainer(&scope_timer_, cfg.start_paused(), this,
63 subscriptions_div_, history_header_div_)),
64 regex_filter_div_(new RegexFilterContainer(model_, proxy_, moos_scope_config_)),
65 scope_tree_view_(new LiaisonScopeMOOSTreeView(moos_scope_config_)),
66 bottom_fill_(new WContainerWidget)
68 protobuf::ZeroMQServiceConfig ipc_sockets;
69 protobuf::ZeroMQServiceConfig::Socket* internal_subscribe_socket = ipc_sockets.add_socket();
70 internal_subscribe_socket->set_socket_type(protobuf::ZeroMQServiceConfig::Socket::SUBSCRIBE);
71 internal_subscribe_socket->set_socket_id(LIAISON_INTERNAL_SUBSCRIBE_SOCKET);
72 internal_subscribe_socket->set_transport(protobuf::ZeroMQServiceConfig::Socket::INPROC);
73 internal_subscribe_socket->set_connect_or_bind(protobuf::ZeroMQServiceConfig::Socket::CONNECT);
74 internal_subscribe_socket->set_socket_name(liaison_internal_publish_socket_name());
76 protobuf::ZeroMQServiceConfig::Socket* internal_publish_socket = ipc_sockets.add_socket();
77 internal_publish_socket->set_socket_type(protobuf::ZeroMQServiceConfig::Socket::PUBLISH);
78 internal_publish_socket->set_socket_id(LIAISON_INTERNAL_PUBLISH_SOCKET);
79 internal_publish_socket->set_transport(protobuf::ZeroMQServiceConfig::Socket::INPROC);
80 internal_publish_socket->set_connect_or_bind(protobuf::ZeroMQServiceConfig::Socket::CONNECT);
81 internal_publish_socket->set_socket_name(liaison_internal_subscribe_socket_name());
83 zeromq_service_->merge_cfg(ipc_sockets);
85 this->resize(WLength::Auto, WLength(100, WLength::Percentage));
87 zeromq_service_->socket_from_id(LIAISON_INTERNAL_SUBSCRIBE_SOCKET)
88 .set_global_blackout(boost::posix_time::milliseconds(1 / cfg.update_freq() * 1e3));
90 setStyleClass(
"scope");
92 proxy_->setSourceModel(model_);
93 scope_tree_view_->setModel(proxy_);
94 scope_tree_view_->sortByColumn(moos_scope_config_.sort_by_column(),
95 moos_scope_config_.sort_ascending() ? AscendingOrder
98 main_layout_->addWidget(controls_div_);
99 main_layout_->addWidget(subscriptions_div_);
100 main_layout_->addWidget(history_header_div_);
101 main_layout_->addWidget(regex_filter_div_);
102 main_layout_->addWidget(scope_tree_view_);
103 main_layout_->setResizable(main_layout_->count() - 1);
104 main_layout_->addWidget(bottom_fill_, -1, AlignTop);
105 main_layout_->addStretch(1);
106 bottom_fill_->resize(WLength::Auto, 100);
108 for (
int i = 0, n = moos_scope_config_.subscription_size(); i < n; ++i)
109 subscriptions_div_->add_subscription(moos_scope_config_.subscription(i));
111 for (
int i = 0, n = moos_scope_config_.history_size(); i < n; ++i)
112 history_header_div_->add_history(moos_scope_config_.history(i));
114 goby::moos::moos_technique = moos_scope_config_.moos_parser_technique();
116 wApp->globalKeyPressed().connect(
this, &LiaisonScope::handle_global_key);
118 scope_timer_.setInterval(1 / cfg.update_freq() * 1.0e3);
119 scope_timer_.timeout().connect(
this, &LiaisonScope::loop);
121 set_name(
"MOOSScope");
124 void goby::common::LiaisonScope::loop()
128 glog.is(DEBUG2) &&
glog <<
"LiaisonScope: polling" << std::endl;
129 while (zeromq_service_->poll(0)) {}
133 void goby::common::LiaisonScope::attach_pb_rows(
const std::vector<Wt::WStandardItem*>& items,
136 const std::string& value = msg.GetString();
137 boost::shared_ptr<google::protobuf::Message> pb_msg = dynamic_parse_for_moos(value);
139 Wt::WStandardItem* key_item = items[protobuf::MOOSScopeConfig::COLUMN_KEY];
141 std::vector<std::string> result;
144 std::string debug_string = pb_msg->DebugString();
145 boost::trim(debug_string);
147 boost::split(result, debug_string, boost::is_any_of(
"\n"));
148 items[protobuf::MOOSScopeConfig::COLUMN_TYPE]->setText(
149 pb_msg->GetDescriptor()->full_name() +
" (Protobuf)");
150 items[protobuf::MOOSScopeConfig::COLUMN_VALUE]->setText(pb_msg->ShortDebugString());
154 boost::split(result, value, boost::is_any_of(
","));
157 key_item->setRowCount(result.size());
158 key_item->setColumnCount(protobuf::MOOSScopeConfig::COLUMN_MAX + 1);
160 for (
int i = 0, n = result.size(); i < n; ++i)
162 for (
int j = 0; j <= protobuf::MOOSScopeConfig::COLUMN_MAX; ++j)
164 if (!key_item->child(i, j))
165 key_item->setChild(i, j,
new Wt::WStandardItem);
167 if (j == protobuf::MOOSScopeConfig::COLUMN_VALUE)
169 key_item->child(i, j)->setText(result[i]);
174 key_item->child(i, j)->setText(items[j]->text());
175 key_item->child(i, j)->setStyleClass(
"invisible");
181 std::vector<Wt::WStandardItem*> goby::common::LiaisonScope::create_row(
CMOOSMsg& msg)
183 std::vector<Wt::WStandardItem*> items;
184 for (
int i = 0; i <= protobuf::MOOSScopeConfig::COLUMN_MAX; ++i)
185 items.push_back(
new WStandardItem);
186 update_row(msg, items);
191 void goby::common::LiaisonScope::update_row(
CMOOSMsg& msg,
const std::vector<WStandardItem*>& items)
193 items[protobuf::MOOSScopeConfig::COLUMN_KEY]->setText(msg.GetKey());
195 items[protobuf::MOOSScopeConfig::COLUMN_TYPE]->setText((msg.IsDouble() ?
"double" :
"string"));
198 items[protobuf::MOOSScopeConfig::COLUMN_VALUE]->setData(msg.GetDouble(), DisplayRole);
200 items[protobuf::MOOSScopeConfig::COLUMN_VALUE]->setData(msg.GetString(), DisplayRole);
202 items[protobuf::MOOSScopeConfig::COLUMN_TIME]->setData(
205 items[protobuf::MOOSScopeConfig::COLUMN_COMMUNITY]->setText(msg.GetCommunity());
206 items[protobuf::MOOSScopeConfig::COLUMN_SOURCE]->setText(msg.m_sSrc);
207 items[protobuf::MOOSScopeConfig::COLUMN_SOURCE_AUX]->setText(msg.GetSourceAux());
210 attach_pb_rows(items, msg);
213 void goby::common::LiaisonScope::handle_global_key(Wt::WKeyEvent
event)
219 subscriptions_div_->refresh_with_newest();
220 history_header_div_->flush_buffer();
224 case Key_P: controls_div_->handle_play_pause(
true);
230 void goby::common::LiaisonScope::pause() { controls_div_->pause(); }
232 void goby::common::LiaisonScope::resume() { controls_div_->resume(); }
234 void goby::common::LiaisonScope::moos_inbox(
CMOOSMsg& msg)
238 std::map<std::string, HistoryContainer::MVC>::iterator hist_it =
239 history_header_div_->history_models_.find(msg.GetKey());
240 if (hist_it != history_header_div_->history_models_.end())
243 history_header_div_->buffer_.push_back(msg);
248 handle_message(msg,
true);
252 void goby::common::LiaisonScope::handle_message(
CMOOSMsg& msg,
bool fresh_message)
256 std::map<std::string, int>::iterator it = msg_map_.find(msg.GetKey());
257 if (it != msg_map_.end())
259 std::vector<WStandardItem*> items;
260 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_KEY));
261 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_TYPE));
262 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_VALUE));
263 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_TIME));
264 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_COMMUNITY));
265 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_SOURCE));
266 items.push_back(model_->item(it->second, protobuf::MOOSScopeConfig::COLUMN_SOURCE_AUX));
267 update_row(msg, items);
271 std::vector<WStandardItem*> items = create_row(msg);
272 msg_map_.insert(make_pair(msg.GetKey(), model_->rowCount()));
273 model_->appendRow(items);
274 history_model_->addString(msg.GetKey());
275 history_model_->sort(0);
276 regex_filter_div_->handle_set_regex_filter();
281 history_header_div_->display_message(msg);
296 goby::common::LiaisonScopeMOOSTreeView::LiaisonScopeMOOSTreeView(
297 const protobuf::MOOSScopeConfig& moos_scope_config, Wt::WContainerWidget* parent )
300 this->setAlternatingRowColors(
true);
302 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_KEY,
303 moos_scope_config.column_width().key_width());
304 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_TYPE,
305 moos_scope_config.column_width().type_width());
306 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_VALUE,
307 moos_scope_config.column_width().value_width());
308 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_TIME,
309 moos_scope_config.column_width().time_width());
310 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_COMMUNITY,
311 moos_scope_config.column_width().community_width());
312 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_SOURCE,
313 moos_scope_config.column_width().source_width());
314 this->setColumnWidth(protobuf::MOOSScopeConfig::COLUMN_SOURCE_AUX,
315 moos_scope_config.column_width().source_aux_width());
317 this->resize(Wt::WLength::Auto, moos_scope_config.scope_height());
319 this->setMinimumSize(moos_scope_config.column_width().key_width() +
320 moos_scope_config.column_width().type_width() +
321 moos_scope_config.column_width().value_width() +
322 moos_scope_config.column_width().time_width() +
323 moos_scope_config.column_width().community_width() +
324 moos_scope_config.column_width().source_width() +
325 moos_scope_config.column_width().source_aux_width() +
326 7 * (protobuf::MOOSScopeConfig::COLUMN_MAX + 1),
347 goby::common::LiaisonScopeMOOSModel::LiaisonScopeMOOSModel(
348 const protobuf::MOOSScopeConfig& moos_scope_config, Wt::WContainerWidget* parent )
349 : WStandardItemModel(0, protobuf::MOOSScopeConfig::COLUMN_MAX + 1, parent)
351 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_KEY, Horizontal, std::string(
"Key"));
352 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_TYPE, Horizontal, std::string(
"Type"));
353 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_VALUE, Horizontal, std::string(
"Value"));
354 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_TIME, Horizontal, std::string(
"Time"));
355 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_COMMUNITY, Horizontal,
356 std::string(
"Community"));
357 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_SOURCE, Horizontal,
358 std::string(
"Source"));
359 this->setHeaderData(protobuf::MOOSScopeConfig::COLUMN_SOURCE_AUX, Horizontal,
360 std::string(
"Source Aux"));
363 goby::common::LiaisonScope::ControlsContainer::ControlsContainer(
364 Wt::WTimer* timer,
bool start_paused, LiaisonScope* scope,
365 SubscriptionsContainer* subscriptions_div, HistoryContainer* history_header_div,
366 Wt::WContainerWidget* parent )
367 :
Wt::WContainerWidget(parent), timer_(timer),
368 play_pause_button_(new WPushButton(
"Play/Pause [p]", this)),
369 spacer_(new
Wt::WText(
" ", this)), play_state_(new
Wt::WText(this)), is_paused_(start_paused),
370 scope_(scope), subscriptions_div_(subscriptions_div), history_header_div_(history_header_div)
372 play_pause_button_->clicked().connect(
373 boost::bind(&ControlsContainer::handle_play_pause,
this,
true));
375 handle_play_pause(
false);
378 goby::common::LiaisonScope::ControlsContainer::~ControlsContainer()
382 if (paused_mail_thread_ && paused_mail_thread_->joinable())
383 paused_mail_thread_->join();
386 void goby::common::LiaisonScope::ControlsContainer::handle_play_pause(
bool toggle_state)
389 is_paused_ = !(is_paused_);
391 is_paused_ ? pause() : resume();
392 play_state_->setText(is_paused_ ?
"Paused ([enter] refreshes). " :
"Playing... ");
395 void goby::common::LiaisonScope::ControlsContainer::pause()
401 paused_mail_thread_.reset(
402 new boost::thread(boost::bind(&ControlsContainer::run_paused_mail,
this)));
405 void goby::common::LiaisonScope::ControlsContainer::resume()
409 if (paused_mail_thread_ && paused_mail_thread_->joinable())
410 paused_mail_thread_->join();
414 subscriptions_div_->refresh_with_newest();
415 history_header_div_->flush_buffer();
418 void goby::common::LiaisonScope::ControlsContainer::run_paused_mail()
422 while (scope_->zeromq_service_->poll(10000)) {}
426 goby::common::LiaisonScope::SubscriptionsContainer::SubscriptionsContainer(
427 LiaisonScope* node, Wt::WStandardItemModel* model, Wt::WStringListModel* history_model,
428 std::map<std::string, int>& msg_map, Wt::WContainerWidget* parent )
429 : WContainerWidget(parent), node_(node), model_(model), history_model_(history_model),
430 msg_map_(msg_map), add_text_(new WText(
"Add subscription (e.g. NAV* or NAV_X): ", this)),
431 subscribe_filter_text_(new WLineEdit(this)),
432 subscribe_filter_button_(new WPushButton(
"Apply", this)), subscribe_break_(new WBreak(this)),
433 remove_text_(new WText(
"Subscriptions (click to remove): ", this))
435 subscribe_filter_button_->clicked().connect(
this,
436 &SubscriptionsContainer::handle_add_subscription);
437 subscribe_filter_text_->enterPressed().connect(
438 this, &SubscriptionsContainer::handle_add_subscription);
441 void goby::common::LiaisonScope::SubscriptionsContainer::handle_add_subscription()
443 add_subscription(subscribe_filter_text_->text().narrow());
444 subscribe_filter_text_->setText(
"");
447 void goby::common::LiaisonScope::SubscriptionsContainer::add_subscription(std::string type)
450 if (type.empty() || subscriptions_.count(type))
453 WPushButton* new_button =
new WPushButton(
this);
455 new_button->setText(type +
" ");
456 node_->subscribe(type, LIAISON_INTERNAL_SUBSCRIBE_SOCKET);
458 new_button->clicked().connect(
459 boost::bind(&SubscriptionsContainer::handle_remove_subscription,
this, new_button));
461 subscriptions_.insert(type);
463 refresh_with_newest(type);
466 void goby::common::LiaisonScope::SubscriptionsContainer::refresh_with_newest()
468 for (std::set<std::string>::const_iterator it = subscriptions_.begin(),
469 end = subscriptions_.end();
471 refresh_with_newest(*it);
474 void goby::common::LiaisonScope::SubscriptionsContainer::refresh_with_newest(
475 const std::string& type)
477 std::vector<CMOOSMsg> newest = node_->newest_substr(type);
478 for (std::vector<CMOOSMsg>::iterator it = newest.begin(), end = newest.end(); it != end; ++it)
479 { node_->handle_message(*it,
false); } }
481 void goby::common::LiaisonScope::SubscriptionsContainer::handle_remove_subscription(
482 WPushButton* clicked_button)
484 std::string type_name = clicked_button->text().narrow();
485 boost::trim(type_name);
486 unsigned type_name_size = type_name.size();
488 node_->unsubscribe(clicked_button->text().narrow(), LIAISON_INTERNAL_SUBSCRIBE_SOCKET);
489 subscriptions_.erase(type_name);
491 bool has_wildcard_ending = (type_name[type_name_size - 1] ==
'*');
492 if (has_wildcard_ending)
493 type_name = type_name.substr(0, type_name_size - 1);
495 for (
int i = model_->rowCount() - 1, n = 0; i >= n; --i)
497 std::string text_to_match = model_->item(i, 0)->text().narrow();
498 boost::trim(text_to_match);
501 if (has_wildcard_ending && boost::starts_with(text_to_match, type_name))
503 else if (!has_wildcard_ending && boost::equals(text_to_match, type_name))
508 history_model_->removeRows(msg_map_[text_to_match], 1);
509 msg_map_.erase(text_to_match);
510 glog.is(DEBUG1) &&
glog <<
"LiaisonScope: removed " << text_to_match << std::endl;
511 model_->removeRow(i);
514 for (std::map<std::string, int>::iterator it = msg_map_.begin(), n = msg_map_.end();
523 this->removeWidget(clicked_button);
524 delete clicked_button;
527 goby::common::LiaisonScope::HistoryContainer::HistoryContainer(
528 MOOSNode* node, Wt::WVBoxLayout* main_layout, Wt::WAbstractItemModel* model,
529 const protobuf::MOOSScopeConfig& moos_scope_config, Wt::WContainerWidget* parent )
530 :
Wt::WContainerWidget(parent), node_(node), main_layout_(main_layout),
531 moos_scope_config_(moos_scope_config), hr_(new WText(
"<hr />", this)),
532 add_text_(new WText((
"Add history for key: "), this)), history_box_(new WComboBox(this)),
533 history_button_(new WPushButton(
"Add", this)), buffer_(moos_scope_config.max_history_items())
536 history_box_->setModel(model);
537 history_button_->clicked().connect(
this, &HistoryContainer::handle_add_history);
540 void goby::common::LiaisonScope::HistoryContainer::handle_add_history()
542 std::string selected_key = history_box_->currentText().narrow();
544 config.set_key(selected_key);
548 void goby::common::LiaisonScope::HistoryContainer::add_history(
551 const std::string& selected_key = config.key();
553 if (!history_models_.count(selected_key))
555 Wt::WContainerWidget* new_container =
new WContainerWidget;
557 Wt::WContainerWidget* text_container =
new WContainerWidget(new_container);
558 new WText(
"History for ", text_container);
559 WPushButton* remove_history_button =
new WPushButton(selected_key, text_container);
561 remove_history_button->clicked().connect(
562 boost::bind(&HistoryContainer::handle_remove_history,
this, selected_key));
564 new WText(
" (click to remove)", text_container);
565 new WBreak(text_container);
570 Wt::WStandardItemModel* new_model =
571 new LiaisonScopeMOOSModel(moos_scope_config_, new_container);
573 Wt::WSortFilterProxyModel* new_proxy =
new Wt::WSortFilterProxyModel(new_container);
574 new_proxy->setSourceModel(new_model);
604 Wt::WTreeView* new_tree =
new LiaisonScopeMOOSTreeView(moos_scope_config_, new_container);
605 main_layout_->insertWidget(main_layout_->count() - 2, new_container);
607 main_layout_->setResizable(main_layout_->count() - 3);
613 new_tree->setModel(new_proxy);
614 MVC& mvc = history_models_[selected_key];
615 mvc.key = selected_key;
616 mvc.container = new_container;
617 mvc.model = new_model;
619 mvc.proxy = new_proxy;
621 node_->zeromq_service()
622 ->socket_from_id(LIAISON_INTERNAL_SUBSCRIBE_SOCKET)
623 .set_blackout(MARSHALLING_MOOS,
"CMOOSMsg/" + selected_key +
"/",
624 boost::posix_time::milliseconds(0));
626 new_proxy->setFilterRegExp(
".*");
627 new_tree->sortByColumn(protobuf::MOOSScopeConfig::COLUMN_TIME, DescendingOrder);
631 void goby::common::LiaisonScope::HistoryContainer::handle_remove_history(std::string key)
633 glog.is(DEBUG2) &&
glog <<
"LiaisonScope: removing history for: " << key << std::endl;
635 main_layout_->removeWidget(history_models_[key].container);
636 main_layout_->removeWidget(history_models_[key].tree);
638 history_models_.erase(key);
641 void goby::common::LiaisonScope::HistoryContainer::toggle_history_plot(Wt::WWidget* plot)
643 if (plot->isHidden())
649 void goby::common::LiaisonScope::HistoryContainer::display_message(
CMOOSMsg& msg)
651 std::map<std::string, HistoryContainer::MVC>::iterator hist_it =
652 history_models_.find(msg.GetKey());
653 if (hist_it != history_models_.end())
655 hist_it->second.model->appendRow(create_row(msg));
656 while (hist_it->second.model->rowCount() > moos_scope_config_.max_history_items())
657 hist_it->second.model->removeRow(0);
659 hist_it->second.proxy->setFilterRegExp(
".*");
663 void goby::common::LiaisonScope::HistoryContainer::flush_buffer()
665 for (boost::circular_buffer<CMOOSMsg>::iterator it = buffer_.begin(), end = buffer_.end();
667 { display_message(*it); } buffer_.clear();
670 goby::common::LiaisonScope::RegexFilterContainer::RegexFilterContainer(
671 Wt::WStandardItemModel* model, Wt::WSortFilterProxyModel* proxy,
672 const protobuf::MOOSScopeConfig& moos_scope_config, Wt::WContainerWidget* parent )
673 :
Wt::WContainerWidget(parent), model_(model), proxy_(proxy), hr_(new WText(
"<hr />", this)),
674 set_text_(new WText((
"Set regex filter: Column: "), this)),
675 regex_column_select_(new
Wt::WComboBox(this)),
676 expression_text_(new WText((
" Expression: "), this)),
677 regex_filter_text_(new WLineEdit(moos_scope_config.regex_filter_expression(), this)),
678 regex_filter_button_(new WPushButton(
"Set", this)),
679 regex_filter_clear_(new WPushButton(
"Clear", this)),
680 regex_filter_examples_(new WPushButton(
"Examples", this)), break_(new WBreak(this)),
681 regex_examples_table_(new WTable(this))
683 for (
int i = 0, n = model_->columnCount(); i < n; ++i)
684 regex_column_select_->addItem(boost::any_cast<std::string>(model_->headerData(i)));
685 regex_column_select_->setCurrentIndex(moos_scope_config.regex_filter_column());
687 regex_filter_button_->clicked().connect(
this, &RegexFilterContainer::handle_set_regex_filter);
688 regex_filter_clear_->clicked().connect(
this, &RegexFilterContainer::handle_clear_regex_filter);
689 regex_filter_text_->enterPressed().connect(
this,
690 &RegexFilterContainer::handle_set_regex_filter);
691 regex_filter_examples_->clicked().connect(
this,
692 &RegexFilterContainer::toggle_regex_examples_table);
694 regex_examples_table_->setHeaderCount(1);
695 regex_examples_table_->setStyleClass(
"basic_small");
696 new WText(
"Expression", regex_examples_table_->elementAt(0, 0));
697 new WText(
"Matches", regex_examples_table_->elementAt(0, 1));
698 new WText(
".*", regex_examples_table_->elementAt(1, 0));
699 new WText(
"anything", regex_examples_table_->elementAt(1, 1));
700 new WText(
".*_STATUS", regex_examples_table_->elementAt(2, 0));
701 new WText(
"fields ending in \"_STATUS\"", regex_examples_table_->elementAt(2, 1));
702 new WText(
".*[^(_STATUS)]", regex_examples_table_->elementAt(3, 0));
703 new WText(
"fields <i>not</i> ending in \"_STATUS\"", regex_examples_table_->elementAt(3, 1));
704 new WText(
"-?[[:digit:]]*\\.[[:digit:]]*e?-?[[:digit:]]*",
705 regex_examples_table_->elementAt(4, 0));
706 new WText(
"a floating point number (e.g. -3.456643e7)", regex_examples_table_->elementAt(4, 1));
707 regex_examples_table_->hide();
709 handle_set_regex_filter();
712 void goby::common::LiaisonScope::RegexFilterContainer::handle_set_regex_filter()
714 proxy_->setFilterKeyColumn(regex_column_select_->currentIndex());
715 proxy_->setFilterRegExp(regex_filter_text_->text());
718 void goby::common::LiaisonScope::RegexFilterContainer::handle_clear_regex_filter()
720 regex_filter_text_->setText(
".*");
721 handle_set_regex_filter();
724 void goby::common::LiaisonScope::RegexFilterContainer::toggle_regex_examples_table()
726 regex_examples_table_->isHidden() ? regex_examples_table_->show()
727 : regex_examples_table_->hide();
Helpers for MOOS applications for serializing and parsed Google Protocol buffers messages.
common::FlexOstream glog
Access the Goby logger through this object.
boost::posix_time::ptime unix_double2ptime(double given_time)
convert to boost date_time ptime from the number of seconds (including fractional) since 1/1/1970 0:0...