Skip to content

Commit

Permalink
Continue work on python->C++ call. This refs #5801
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Oct 24, 2012
1 parent c549476 commit 7a0a6e0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public slots:
void multi_color_scale();
void spectrum_color_scale();
void edit_manual_input();
void peak_back_tof_range_update();
void peak_back_tof_range_update();

public:
signals:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class EXPORT_OPT_MANTIDQT_IMAGEVIEWER RefImageView : public QMainWindow

~RefImageView();

void* getIVConnections();

private:
GraphDisplay* h_graph;
GraphDisplay* v_graph;
Expand Down
11 changes: 7 additions & 4 deletions Code/Mantid/MantidQt/RefDetectorViewer/src/RefIVConnections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ void RefIVConnections::graph_range_changed()

void RefIVConnections::peak_back_tof_range_update()
{
std::cout << "Inside RefImageView::peak_back_tof_range_update"<< std::endl;
std::cout << "Inside RefImageView::peak_back_tof_range_update: ";

QLineEdit * peak_left_control = iv_ui->lineEdit_peakLeft;
std::cout << peak_left_control->text().toStdString();
std::cout << peak_left_control->text().toStdString() << std::endl;

// double peakmin = iv_ui->lineEdit_peakLeft->text()->toDouble();
// double peakmax = iv_ui->lineEdit_peakRight->text()->toDouble();
Expand Down Expand Up @@ -464,6 +464,7 @@ void RefIVConnections::imageSplitter_moved()
}


//Right click
void RefIVConnections::imagePicker_moved()
{
QwtPolygon selected_points = image_picker->selection();
Expand All @@ -474,13 +475,15 @@ void RefIVConnections::imagePicker_moved()
}
}

//Left click
void RefIVConnections::imagePicker2_moved()
{
QwtPolygon selected_points = image_picker2->selection();
QwtPolygon selected_points = image_picker2->selection();
if ( selected_points.size() >= 1 )
{
peak_back_tof_range_update();
int index = selected_points.size() - 1;
int mouseClick = 1; //left click
int mouseClick = 1;
image_display->SetPointedAtPoint( selected_points[index], mouseClick );
}
}
Expand Down
7 changes: 6 additions & 1 deletion Code/Mantid/MantidQt/RefDetectorViewer/src/RefImageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RefImageView::RefImageView( RefImageDataSource* data_source )
ui->lineEdit_TOFmax);
saved_image_display = image_display;

RefIVConnections* iv_connections = new RefIVConnections( ui, this,
RefIVConnections * iv_connections = new RefIVConnections( ui, this,
image_display,
h_graph, v_graph );

Expand All @@ -79,6 +79,11 @@ RefImageView::RefImageView( RefImageDataSource* data_source )
image_display->SetDataSource( data_source );
}

void* RefImageView::getIVConnections()
{
return saved_iv_connections;
}

RefImageView::~RefImageView()
{
// std::cout << "ImageView destructor called" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ RefMatrixWSImageView::RefMatrixWSImageView( QString wps_name)

std::cout << "ws->readX(0).size(): " << ws->readX(0).size() << std::endl;
image_view = new RefImageView( source );

void* iv_connections = image_view->getIVConnections();

}

RefMatrixWSImageView::~RefMatrixWSImageView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,8 @@ def _plot_data_count_vs_tof_2d(self):
True,
None)

def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
print 'Inside the call_back on the python side'
# def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
# print 'Inside the call_back on the python side'
# self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
# self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
# self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
Expand All @@ -904,11 +904,23 @@ def call_back(peakmin, peakmax, backmin, backmax, tofmin, tofmax):
# self._summary.x_max_edit.setText("%-d" % int(tofmax))

import _qti
_qti.app.connect(_qti.app.mantidUI, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)
#_qti.app.connect(_qti.app.mantidUI, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)
#_qti.app.connect(_qti.app.RefDetectorViewer, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double,double,double,double,double)"), call_back)

import mantidqtpython
mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base)

self.ref_det_view = mantidqtpython.MantidQt.RefDetectorViewer.RefMatrixWSImageView(ws_output_base)
QtCore.QObject.connect(self.ref_det_view, QtCore.SIGNAL("python_peak_back_tof_range_update(double,double, double,double,double,double)"), self.call_back)


def call_back(self, peakmin, peakmax, backmin, backmax, tofmin, tofmax):
print 'Inside the call_back on the python side'
# self._summary.data_peak_from_pixel.setText("%-d" % int(peakmin))
# self._summary.data_peak_to_pixel.setText("%-d" % int(peakmax))
# self._summary.data_background_from_pixel1.setText("%-d" % int(backmin))
# self._summary.data_background_to_pixel1.setText("%-d" % int(backmax))
# self._summary.x_min_edit.setText("%-d" % int(tofmin))
# self._summary.x_max_edit.setText("%-d" % int(tofmax))

def _norm_count_vs_y(self):

# run_number = self._summary.norm_run_number_edit.text()
Expand Down

0 comments on commit 7a0a6e0

Please sign in to comment.