Skip to content
Snippets Groups Projects
Commit a00513a3 authored by stefan's avatar stefan
Browse files

Renamed "info widget" to "message widget"

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2611 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent f7ed40eb
No related branches found
No related tags found
No related merge requests found
set(OST_GUI_PYMOD_SOURCES
wrap_gui.cc
export_alignment_view.cc
export_info_widget.cc
export_message_widget.cc
export_gl_win.cc
export_plot.cc
export_tool.cc
......
......@@ -99,9 +99,9 @@ void export_Gosty()
return_value_policy<reference_existing_object>())
.add_property("tool_options_win", make_function(&GostyApp::GetToolOptionsWin,
return_value_policy<reference_existing_object>()))
.def("GetInfoWidget", &GostyApp::GetInfoWidget,
.def("GetMessageWidget", &GostyApp::GetMessageWidget,
return_value_policy<reference_existing_object>())
.add_property("info_widget", make_function(&GostyApp::GetInfoWidget,
.add_property("message_widget", make_function(&GostyApp::GetMessageWidget,
return_value_policy<reference_existing_object>()))
#if OST_IMG_ENABLED
.def("CreateDataViewer", &app_create_data_viewer1,return_value_policy<reference_existing_object>())
......
......@@ -21,7 +21,7 @@
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <ost/gui/info_widget/info_widget.hh>
#include <ost/gui/messages/message_widget.hh>
#include "sip_handler.hh"
......@@ -31,27 +31,27 @@ using namespace ost::gui;
namespace {
void log_message_a(InfoWidget* info_widget, const QString& message, QMessageBox::Icon icon = QMessageBox::Information)
void log_message_a(MessageWidget* message_widget, const QString& message, QMessageBox::Icon icon = QMessageBox::Information)
{
info_widget->LogMessage(message,icon);
message_widget->LogMessage(message,icon);
}
void log_message_b(InfoWidget * info_widget, object py_object)
void log_message_b(MessageWidget * message_widget, object py_object)
{
if(py_object.ptr() != Py_None){
if(PyObject_IsInstance(py_object.ptr(), (PyObject*)&PyString_Type)){
String message = extract < std::string > (py_object);
info_widget->LogMessage(QString(message.c_str()));
message_widget->LogMessage(QString(message.c_str()));
}
else if(QStandardItem* item = get_cpp_qobject<QStandardItem>(py_object)){
info_widget->LogMessage(item);
message_widget->LogMessage(item);
}
}
}
}
void export_InfoWidget()
void export_MessageWidget()
{
enum_<QMessageBox::Icon>("MessageIcon")
.value("QUESTION", QMessageBox::Question)
......@@ -61,15 +61,15 @@ void export_InfoWidget()
.export_values()
;
class_<InfoWidget, boost::noncopyable>("InfoWidget", no_init)
.def("Show", &InfoWidget::show)
.def("Hide", &InfoWidget::hide)
.def("Clear", &InfoWidget::Clear)
.def("RemoveSelected", &InfoWidget::RemoveSelected)
class_<MessageWidget, boost::noncopyable>("MessageWidget", no_init)
.def("Show", &MessageWidget::show)
.def("Hide", &MessageWidget::hide)
.def("Clear", &MessageWidget::Clear)
.def("RemoveSelected", &MessageWidget::RemoveSelected)
.def("LogMessage", &log_message_a)
.def("LogMessage", &log_message_b)
.def("GetQObject",&get_py_qobject<InfoWidget>)
.add_property("qobject", &get_py_qobject<InfoWidget>)
.def("GetQObject",&get_py_qobject<MessageWidget>)
.add_property("qobject", &get_py_qobject<MessageWidget>)
;
}
......@@ -28,7 +28,7 @@ void export_AlignmentView();
void export_Tool();
void export_Plot();
void export_GLWin();
void export_InfoWidget();
void export_MessageWidget();
void export_Gosty();
void export_PyShell();
void export_SceneWin();
......@@ -110,7 +110,7 @@ BOOST_PYTHON_MODULE(_gui)
export_AlignmentView();
export_Tool();
export_Plot();
export_InfoWidget();
export_MessageWidget();
export_GLWin();
export_MainArea();
export_PyShell();
......
......@@ -91,8 +91,8 @@ scene_win.hh
scene_win_model.hh
)
set(OST_GUI_INFO_WIDGET_HEADERS
info_widget.hh
set(OST_GUI_MESSAGES_HEADERS
message_widget.hh
log_reader.hh
)
......@@ -212,8 +212,8 @@ widget.cc
admin.cc
widget_pool.cc
remote_site_loader.cc
info_widget/info_widget.cc
info_widget/log_reader.cc
messages/message_widget.cc
messages/log_reader.cc
sequence_viewer/align_properties_painter.cc
sequence_viewer/base_row.cc
sequence_viewer/background_painter.cc
......@@ -347,8 +347,8 @@ scene_selection.hh
widget.hh
widget_geom_handler.hh
widget_pool.hh
info_widget/info_widget.hh
info_widget/log_reader.hh
messages/message_widget.hh
messages/log_reader.hh
sequence_viewer/align_properties_painter.hh
sequence_viewer/background_painter.hh
sequence_viewer/base_row.hh
......@@ -482,7 +482,7 @@ module(NAME gui SOURCES ${OST_GUI_MOCS} ${OST_GUI_SOURCES}
${OST_GUI_PYTHON_SHELL_HEADERS} IN_DIR python_shell
${OST_GUI_PANEL_BAR_HEADERS} IN_DIR panels
${OST_GUI_SCENE_WIN_HEADERS} IN_DIR scene_win
${OST_GUI_INFO_WIDGET_HEADERS} IN_DIR info_widget
${OST_GUI_MESSAGES_HEADERS} IN_DIR messages
${OST_GUI_INPUT_HEADERS}
${OST_GUI_DATA_VIEWER_HEADERS}
${OST_GUI_HEADERS}
......
......@@ -85,7 +85,7 @@ AdminRights::~AdminRights()
{ }
bool AdminRights::Acquire()
{ }
{ return false; }
void AdminRights::Release()
{ }
......
......@@ -43,7 +43,7 @@ GostyApp* GostyApp::app_=NULL;
GostyApp::GostyApp():
py_shell_(NULL), gl_win_(NULL), scene_win_(NULL), info_widget_(NULL), seq_viewer_(NULL),
py_shell_(NULL), gl_win_(NULL), scene_win_(NULL), message_widget_(NULL), seq_viewer_(NULL),
tool_options_win_(NULL), main_(new GostyMainWindow),
perspective_(NULL), external_widgets_(QMap<QString,WidgetGeomHandler *>())
{
......@@ -139,12 +139,12 @@ Perspective* GostyApp::GetPerspective()
return perspective_;
}
InfoWidget* GostyApp::GetInfoWidget()
MessageWidget* GostyApp::GetMessageWidget()
{
if (info_widget_==NULL) {
info_widget_=new InfoWidget(main_);
if (message_widget_==NULL) {
message_widget_=new MessageWidget(main_);
}
return info_widget_;
return message_widget_;
}
void GostyApp::AddWidgetToApp(const QString& ident, QWidget* widget)
......
......@@ -33,7 +33,7 @@
#include <ost/gui/widget_geom_handler.hh>
#include <ost/gui/scene_win/scene_win.hh>
#include <ost/gui/sequence_viewer/sequence_viewer.hh>
#include <ost/gui/info_widget/info_widget.hh>
#include <ost/gui/messages/message_widget.hh>
#if OST_IMG_ENABLED
#include <ost/gui/data_viewer/data_viewer.hh>
......@@ -101,11 +101,11 @@ public:
/// All subsequent calls will return the same SceneWin instance.
ToolOptionsWin* GetToolOptionsWin();
/// \brief get info widget
/// \brief get message widget
///
/// The InfoWidget is initialized when this method is first called.
/// All subsequent calls will return the same InfoWidget instance.
InfoWidget* GetInfoWidget();
/// The MessageWidget is initialized when this method is first called.
/// All subsequent calls will return the same MessageWidget instance.
MessageWidget* GetMessageWidget();
#if OST_IMG_ENABLED
/// \brief create new DataViewer
......@@ -157,7 +157,7 @@ private:
SceneWin* scene_win_;
InfoWidget* info_widget_;
MessageWidget* message_widget_;
SequenceViewer* seq_viewer_;
......
......@@ -21,7 +21,7 @@
*/
#include <ost/log.hh>
#include "info_widget.hh"
#include "message_widget.hh"
#include "log_reader.hh"
namespace ost { namespace gui {
......@@ -35,15 +35,15 @@ LogReader::LogReader(QObject* parent) :
void LogReader::LogMessage(const String& message, int severity){
if(this->parent()){
if(InfoWidget* info_widget = qobject_cast<InfoWidget*>(this->parent())){
if(MessageWidget* message_widget = qobject_cast<MessageWidget*>(this->parent())){
QString q_message(message.c_str());
if(q_message.endsWith("\n")){
q_message.remove(q_message.size()-1,q_message.size()-1);
if(!log_cache_.contains(severity)){
info_widget->LogMessage(q_message,GetIconForSeverity(severity));
message_widget->LogMessage(q_message,GetIconForSeverity(severity));
}
else{
info_widget->LogMessage(log_cache_[severity]+q_message,GetIconForSeverity(severity));
message_widget->LogMessage(log_cache_[severity]+q_message,GetIconForSeverity(severity));
log_cache_.remove(severity);
}
}
......
......@@ -16,8 +16,8 @@
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
#ifndef OST_GUI_INFO_WIDGET_LOG_READER_HH
#define OST_GUI_INFO_WIDGET_LOG_READER_HH
#ifndef OST_GUI_MESSAGES_LOG_READER_HH
#define OST_GUI_MESSAGES_LOG_READER_HH
#include <QObject>
#include <QMap>
......
......@@ -30,24 +30,24 @@
#include <ost/gui/gosty_app.hh>
#include "log_reader.hh"
#include "info_widget.hh"
#include "message_widget.hh"
namespace ost {namespace gui {
class InfoWidgetFactory: public WidgetFactory {
class MessageWidgetFactory: public WidgetFactory {
public:
InfoWidgetFactory() :
WidgetFactory("ost::gui::InfoWidget", "Info Widget") {
MessageWidgetFactory() :
WidgetFactory("ost::gui::MessageWidget", "Messages") {
}
virtual Widget* Create(QWidget* parent) {
return GostyApp::Instance()->GetInfoWidget();
return GostyApp::Instance()->GetMessageWidget();
}
};
OST_REGISTER_WIDGET(InfoWidget, InfoWidgetFactory);
OST_REGISTER_WIDGET(MessageWidget, MessageWidgetFactory);
InfoWidget::InfoWidget(QWidget* parent) :
MessageWidget::MessageWidget(QWidget* parent) :
Widget(NULL, parent), model_(new QStandardItemModel(this)), view_(
new QListView(this)) {
QVBoxLayout* layout = new QVBoxLayout(this);
......@@ -79,11 +79,11 @@ InfoWidget::InfoWidget(QWidget* parent) :
new LogReader(this);
}
void InfoWidget::Update() {
void MessageWidget::Update() {
view_->viewport()->update();
}
void InfoWidget::LogMessage(const QString& message, QMessageBox::Icon icon) {
void MessageWidget::LogMessage(const QString& message, QMessageBox::Icon icon) {
QPixmap pix_icon = this->GetIcon(icon, this);
QStandardItem* item = new QStandardItem();
item->setText(message);
......@@ -92,11 +92,11 @@ void InfoWidget::LogMessage(const QString& message, QMessageBox::Icon icon) {
this->model_->appendRow(item);
}
void InfoWidget::LogMessage(QStandardItem* item) {
void MessageWidget::LogMessage(QStandardItem* item) {
this->model_->appendRow(item);
}
void InfoWidget::LogMessage(const QString& message, QIcon icon) {
void MessageWidget::LogMessage(const QString& message, QIcon icon) {
QStandardItem* item = new QStandardItem();
item->setText(message);
item->setIcon(icon);
......@@ -104,7 +104,7 @@ void InfoWidget::LogMessage(const QString& message, QIcon icon) {
this->model_->appendRow(item);
}
QPixmap InfoWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) {
QPixmap MessageWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) {
QStyle *style = widget ? widget->style() : QApplication::style();
int icon_size = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, widget);
QIcon tmp_icon;
......@@ -128,11 +128,11 @@ QPixmap InfoWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) {
return QPixmap();
}
void InfoWidget::Clear() {
void MessageWidget::Clear() {
this->model_->clear();
}
void InfoWidget::RemoveSelected() {
void MessageWidget::RemoveSelected() {
QItemSelectionModel* selection_model = this->view_->selectionModel();
const QItemSelection& item_selection = selection_model->selection();
const QModelIndexList& model_indexes = item_selection.indexes();
......@@ -141,11 +141,11 @@ void InfoWidget::RemoveSelected() {
}
}
ActionList InfoWidget::GetActions() {
ActionList MessageWidget::GetActions() {
return this->actions_;
}
void InfoWidget::ContextMenuRequested(const QPoint& pos) {
void MessageWidget::ContextMenuRequested(const QPoint& pos) {
QAction* remove_selected_action = new QAction("Remove", this);
remove_selected_action->setToolTip("Remove this item");
......@@ -159,7 +159,7 @@ void InfoWidget::ContextMenuRequested(const QPoint& pos) {
}
}
InfoWidget::~InfoWidget() {
MessageWidget::~MessageWidget() {
}
}
......
......@@ -16,8 +16,8 @@
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
#ifndef OST_GUI_INFO_WIDGET_INFO_WIDGET_HH
#define OST_GUI_INFO_WIDGET_INFO_WIDGET_HH
#ifndef OST_GUI_MESSAGES_MESSAGE_WIDGET_HH
#define OST_GUI_MESSAGES_MESSAGE_WIDGET_HH
#include <QListView>
#include <QMessageBox>
......@@ -32,13 +32,13 @@
namespace ost { namespace gui {
// the display window for all graphical objects
class DLLEXPORT_OST_GUI InfoWidget: public Widget
// the display window for Log Messages
class DLLEXPORT_OST_GUI MessageWidget: public Widget
{
Q_OBJECT;
public:
InfoWidget(QWidget* parent=NULL);
~InfoWidget();
MessageWidget(QWidget* parent=NULL);
~MessageWidget();
public:
virtual void LogMessage(const QString& message, QMessageBox::Icon icon=QMessageBox::Information);
......
......@@ -45,7 +45,7 @@ def _InitPanels(app):
panels.AddWidgetToPool('ost.gui.RemoteLoader', -1)
panels.AddWidgetToPool('ost.gui.SceneWin', 1)
panels.AddWidgetToPool('ost.gui.SequenceViewer', 1)
panels.AddWidgetToPool('ost.gui.InfoWidget', 1)
panels.AddWidgetToPool('ost.gui.MessageWidget', 1)
if not panels.Restore("ui/perspective/panels"):
panels.AddWidget(gui.PanelPosition.LEFT_PANEL, app.scene_win)
panels.AddWidgetByName(gui.PanelPosition.LEFT_PANEL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment