Commit f9b696ab authored by Ingo Meyer's avatar Ingo Meyer

Merge branch 'develop'

parents 05289bad d4f526e2
__version_info__ = (0, 6, 2)
__version_info__ = (0, 7, 0)
__version__ = '.'.join(map(str, __version_info__))
......@@ -3,7 +3,7 @@
from PyQt4 import QtCore, QtGui
import gr
from qtgr import GRWidget
import os
import csv
from util.logger import Logger
import sys
......@@ -123,6 +123,7 @@ class HistogramWidget(QtGui.QWidget):
binbox = QtGui.QHBoxLayout()
binbox.addWidget(QtGui.QLabel("Number of Bins:", self), 0)
self.nbins = QtGui.QLineEdit(self)
self.nbins.setMinimumWidth(50)
binbox.addWidget(self.nbins, 0, QtCore.Qt.AlignLeft)
grid.addLayout(binbox, 0, 2)
......@@ -132,9 +133,13 @@ class HistogramWidget(QtGui.QWidget):
buttonbox.addWidget(self.plotbutton)
self.connect(self.plotbutton, QtCore.SIGNAL("clicked()"), self.draw)
self.exportbutton = QtGui.QPushButton("Save Image", self)
buttonbox.addWidget(self.exportbutton)
self.connect(self.exportbutton, QtCore.SIGNAL("clicked()"), self.export)
self.export_image_button = QtGui.QPushButton("Save Image", self)
buttonbox.addWidget(self.export_image_button)
self.connect(self.export_image_button, QtCore.SIGNAL("clicked()"), self.export_image)
self.export_data_button = QtGui.QPushButton("Export Data", self)
buttonbox.addWidget(self.export_data_button)
self.connect(self.export_data_button, QtCore.SIGNAL("clicked()"), self.export_data)
grid.addLayout(buttonbox, 1, 0, 1, 3)
vbox.addWidget(self.gr_widget, stretch=1)
......@@ -185,7 +190,7 @@ class HistogramWidget(QtGui.QWidget):
if now:
self.gr_widget.draw(wsviewport=wsviewport)
def export(self):
def export_image(self):
extensions = (".pdf", ".png", ".bmp", ".jpg", ".jpeg", ".png",
".tiff", ".fig", ".svg", ".wmf", ".eps", ".ps")
qtext = "*" + " *".join(extensions)
......@@ -202,6 +207,22 @@ class HistogramWidget(QtGui.QWidget):
self.draw(now=True)
gr.endprint()
def export_data(self):
qtext = " *.csv"
filepath = QtGui.QFileDialog.getSaveFileName(self, "Save Data",
".", "CSV Files ({})".format(qtext))
if len(filepath) == 0:
return
self.draw()
xvalues = self.gr_widget.xvalues
yvalues = self.gr_widget.yvalues
if xvalues is None or yvalues is None:
return
with open(filepath, 'wb') as csvfile:
csvwriter = csv.writer(csvfile)
for x, y in zip(xvalues, yvalues):
csvwriter.writerow([x, y])
def refresh(self):
self.cavity_type_box.clear()
results = self.control.results
......
......@@ -4,7 +4,7 @@
from PyQt4 import QtCore, QtGui
import gr
from qtgr import GRWidget
import os
import csv
from util.logger import Logger
import sys
......@@ -112,18 +112,22 @@ class RDFWidget(QtGui.QWidget):
rangebox = QtGui.QHBoxLayout()
rangebox.addWidget(QtGui.QLabel("Plot range:", self))
self.range1 = QtGui.QLineEdit("0", self)
self.range1.setMinimumWidth(30)
rangebox.addWidget(self.range1)
rangebox.addWidget(QtGui.QLabel("-", self))
self.range2 = QtGui.QLineEdit("8", self)
self.range2.setMinimumWidth(30)
rangebox.addWidget(self.range2)
grid.addLayout(rangebox, 0, 1)
cutoffbox = QtGui.QHBoxLayout()
cutoffbox.addWidget(QtGui.QLabel("Cutoff:", self))
self.cutoff = QtGui.QLineEdit("12", self)
self.cutoff.setMinimumWidth(30)
cutoffbox.addWidget(self.cutoff)
cutoffbox.addWidget(QtGui.QLabel("Bandwidth:", self))
self.bandwidth = QtGui.QLineEdit("", self)
self.bandwidth.setMinimumWidth(30)
cutoffbox.addWidget(self.bandwidth)
grid.addLayout(cutoffbox, 0, 2)
......@@ -133,9 +137,13 @@ class RDFWidget(QtGui.QWidget):
buttonbox.addWidget(self.plotbutton)
self.connect(self.plotbutton, QtCore.SIGNAL("clicked()"), self.draw)
self.exportbutton = QtGui.QPushButton("Save Image", self)
buttonbox.addWidget(self.exportbutton)
self.connect(self.exportbutton, QtCore.SIGNAL("clicked()"), self.export)
self.export_image_button = QtGui.QPushButton("Save Image", self)
buttonbox.addWidget(self.export_image_button)
self.connect(self.export_image_button, QtCore.SIGNAL("clicked()"), self.export_image)
self.export_data_button = QtGui.QPushButton("Export Data", self)
buttonbox.addWidget(self.export_data_button)
self.connect(self.export_data_button, QtCore.SIGNAL("clicked()"), self.export_data)
grid.addLayout(buttonbox, 1, 0, 1, 3)
vbox.addWidget(self.gr_widget, stretch=1)
......@@ -187,7 +195,7 @@ class RDFWidget(QtGui.QWidget):
if now:
self.gr_widget.draw(wsviewport=wsviewport)
def export(self):
def export_image(self):
extensions = (".pdf", ".png", ".bmp", ".jpg", ".jpeg", ".png",
".tiff", ".fig", ".svg", ".wmf", ".eps", ".ps")
qtext = "*" + " *".join(extensions)
......@@ -204,6 +212,22 @@ class RDFWidget(QtGui.QWidget):
self.draw(now=True)
gr.endprint()
def export_data(self):
qtext = " *.csv"
filepath = QtGui.QFileDialog.getSaveFileName(self, "Save Data",
".", "CSV Files ({})".format(qtext))
if len(filepath) == 0:
return
self.draw()
xvalues = self.gr_widget.xvalues
yvalues = self.gr_widget.yvalues
if xvalues is None or yvalues is None:
return
with open(filepath, 'wb') as csvfile:
csvwriter = csv.writer(csvfile)
for x, y in zip(xvalues, yvalues):
csvwriter.writerow([x, y])
def refresh(self):
results = self.control.results
if results is not None:
......
......@@ -15,12 +15,23 @@ from core.control import Control
from PyQt4 import QtGui
from PyQt4 import QtCore
import signal
import subprocess
import sys
import os
import core.calculation
def main():
if len(sys.argv) > 1 and sys.argv[1] == '--batch':
# The user actually wants to use startBatch.py instead of startGUI.py
# This is implemented here as both Linux and OS X use completely
# different ways to implement the pymoldyn executable, but both call
# startGUI.py.
script_directory = os.path.dirname(os.path.abspath(__file__))
batch_script_path = os.path.join(script_directory, 'startBatch.py')
args = [sys.executable, batch_script_path] + sys.argv[2:]
sys.exit(subprocess.call(args))
os.chdir(os.path.abspath(os.path.dirname(__file__)))
app = QtGui.QApplication(sys.argv)
control = Control()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment