added save_to_variable functionality.

This commit is contained in:
sccolbert
2009-11-07 16:10:07 +01:00
parent cc2b9ae634
commit ac8dadf1ce
+22 -3
View File
@@ -28,6 +28,7 @@ else:
app = None
variable_saved_image = None
class LabelImage(QLabel):
def __init__(self, parent, arr):
@@ -166,17 +167,31 @@ else:
self.save_file = QtGui.QPushButton('Save to File')
self.save_file.clicked.connect(self.save_to_file)
#self.save_variable = QtGui.QPushButton('Save to Variable')
self.save_variable = QtGui.QPushButton('Save to Variable')
self.save_variable.clicked.connect(self.save_to_variable)
self.save_file.show()
#self.save_variable.show()
self.save_variable.show()
#self.layout.addWidget(self.save_variable, 1, 1)
self.layout.addWidget(self.save_variable, 1, 1)
self.layout.addWidget(self.save_file, 1, 2)
def update_histograms(self):
self.rgbv_hist.update_hists(self.arr)
def save_to_variable(self):
global variable_saved_image
variable_saved_image = self.arr.copy()
msg = QLabel('The image has been saved. Call *** to retrieve.')
dialog = QtGui.QDialog()
ok = QtGui.QPushButton('OK', msg)
ok.clicked.connect(dialog.accept)
ok.setDefault(True)
dialog.layout = QtGui.QGridLayout(dialog)
dialog.layout.addWidget(msg, 0, 0, 1, 3)
dialog.layout.addWidget(ok, 1, 1)
dialog.exec_()
def save_to_file(self):
from scikits.image import io
filename = str(QtGui.QFileDialog.getSaveFileName())
@@ -232,6 +247,10 @@ else:
iw.show()
def retrieve_saved_image():
global variable_saved_image
return variable_saved_image
def _app_show():
global app
if app and window_manager.has_windows():