Commit 05289bad authored by Ingo Meyer's avatar Ingo Meyer

Merge branch 'develop'

parents 85f5c058 dfafba5f
__version_info__ = (0, 6, 1)
__version_info__ = (0, 6, 2)
__version__ = '.'.join(map(str, __version_info__))
......@@ -37,7 +37,7 @@ class GrHistogramWidget(GRWidget):
self.widths = widths
self.title = title
def draw(self):
def draw(self, wsviewport=None):
if self.xvalues is not None and self.widths is not None:
maxidx = np.argmax(self.xvalues)
rangex = (self.xvalues.min(),
......@@ -49,7 +49,10 @@ class GrHistogramWidget(GRWidget):
else:
rangey = (0.0, 8.0)
gr.setwsviewport(0, self.mwidth, 0, self.mheight)
if wsviewport is None:
gr.setwsviewport(0, self.mwidth, 0, self.mheight)
else:
gr.setwsviewport(*wsviewport)
gr.setwswindow(0, self.sizex, 0, self.sizey)
gr.setviewport(0.075 * self.sizex, 0.95 * self.sizex,
0.075 * self.sizey, 0.95 * self.sizey)
......@@ -100,6 +103,9 @@ class HistogramWidget(QtGui.QWidget):
self.datasetlabel.setAlignment(QtCore.Qt.AlignHCenter)
selectbox = QtGui.QHBoxLayout()
self.cavity_type_box = QtGui.QComboBox(self)
self.cavity_type_box.setMinimumWidth(180)
selectbox.addWidget(self.cavity_type_box)
selectbuttongroup = QtGui.QButtonGroup(self)
self.volumebutton = QtGui.QRadioButton("Cavity Volume", self)
selectbox.addWidget(self.volumebutton)
......@@ -142,23 +148,29 @@ class HistogramWidget(QtGui.QWidget):
or event.key() == QtCore.Qt.Key_Enter:
self.draw()
def draw(self):
def draw(self, now=False, wsviewport=None):
xvalues = None
yvalues = None
widths = None
title = None
if self.results is None:
self.refresh()
if self.results is not None and self.results.surface_cavities is not None:
if self.cavity_type_box.currentText():
if self.cavity_type_box.currentText() == 'Surface-based Cavities':
cavities = self.results.surface_cavities
elif self.cavity_type_box.currentText() == 'Center-based Cavities':
cavities = self.results.center_cavities
elif self.cavity_type_box.currentText() == 'Cavity Domains':
cavities = self.results.domains
nbins = str(self.nbins.text())
if len(nbins) > 0 and float(nbins) > 0:
nbins = float(nbins)
else:
nbins = 50
if self.volumebutton.isChecked():
data = self.results.surface_cavities.volumes
data = cavities.volumes
else:
data = self.results.surface_cavities.surface_areas
data = cavities.surface_areas
if len(data) > 0:
if self.weightbutton.isChecked():
hist, bin_edges = np.histogram(data, bins=nbins, weights=data)
......@@ -170,23 +182,37 @@ class HistogramWidget(QtGui.QWidget):
self.gr_widget.setdata(xvalues, yvalues, widths, title)
self.gr_widget.update()
if now:
self.gr_widget.draw(wsviewport=wsviewport)
def export(self):
extensions = (".eps", ".ps", ".pdf", ".png", ".bmp", ".jpg", ".jpeg",
".png", ".tiff", ".fig", ".svg", ".wmf")
extensions = (".pdf", ".png", ".bmp", ".jpg", ".jpeg", ".png",
".tiff", ".fig", ".svg", ".wmf", ".eps", ".ps")
qtext = "*" + " *".join(extensions)
filepath = QtGui.QFileDialog.getSaveFileName(self, "Save Image",
".", "Image Files ({})".format(qtext))
if not filepath:
return
gr.beginprint(filepath)
self.draw()
if filepath.endswith('.eps') or filepath.endswith('.ps'):
gr.beginprintext(filepath, 'Color', 'A4', 'Landscape')
self.draw(now=True, wsviewport=(0, 0.297*0.9, 0, 0.21*0.95))
else:
gr.beginprint(filepath)
self.draw(now=True)
gr.endprint()
def refresh(self):
self.cavity_type_box.clear()
results = self.control.results
if results is not None:
results = results[-1][-1]
if results.surface_cavities is not None:
self.cavity_type_box.addItem('Surface-based Cavities')
if results.center_cavities is not None:
self.cavity_type_box.addItem('Center-based Cavities')
if results.domains is not None:
self.cavity_type_box.addItem('Cavity Domains')
if self.results != results:
self.results = results
self.gr_widget.setdata(None, None, None, None)
......
......@@ -42,7 +42,7 @@ class GrPlotWidget(GRWidget):
self.title = title
self.datapoints = datapoints
def draw(self):
def draw(self, wsviewport=None):
if self.xvalues is not None:
rangex = (self.xvalues.min(), self.xvalues.max())
else:
......@@ -52,7 +52,10 @@ class GrPlotWidget(GRWidget):
else:
rangey = (0, 4)
gr.setwsviewport(0, self.mwidth, 0, self.mheight)
if wsviewport is None:
gr.setwsviewport(0, self.mwidth, 0, self.mheight)
else:
gr.setwsviewport(*wsviewport)
gr.setwswindow(0, self.sizex, 0, self.sizey)
gr.setviewport(0.075 * self.sizex, 0.95 * self.sizex,
0.075 * self.sizey, 0.95 * self.sizey)
......@@ -99,8 +102,10 @@ class RDFWidget(QtGui.QWidget):
elembox = QtGui.QHBoxLayout()
elembox.addWidget(QtGui.QLabel("Elements:", self), 0)
self.elem1 = QtGui.QComboBox(self)
self.elem1.setMinimumWidth(170)
elembox.addWidget(self.elem1, 0, QtCore.Qt.AlignLeft)
self.elem2 = QtGui.QComboBox(self)
self.elem2.setMinimumWidth(170)
elembox.addWidget(self.elem2, 0, QtCore.Qt.AlignRight)
grid.addLayout(elembox, 0, 0)
......@@ -144,7 +149,7 @@ class RDFWidget(QtGui.QWidget):
or event.key() == QtCore.Qt.Key_Enter:
self.draw()
def draw(self):
def draw(self, now=False, wsviewport=None):
xvalues = None
yvalues = None
title = None
......@@ -153,7 +158,11 @@ class RDFWidget(QtGui.QWidget):
self.refresh()
if self.rdf is not None:
elem1 = str(self.elem1.currentText())
if elem1 == "cavity domain centers":
elem1 = "cav"
elem2 = str(self.elem2.currentText())
if elem2 == "cavity domain centers":
elem2 = "cav"
range1 = float(str(self.range1.text()))
range2 = float(str(self.range2.text()))
cutoff = str(self.cutoff.text())
......@@ -175,17 +184,24 @@ class RDFWidget(QtGui.QWidget):
self.gr_widget.setdata(xvalues, yvalues, title, datapoints)
self.gr_widget.update()
if now:
self.gr_widget.draw(wsviewport=wsviewport)
def export(self):
extensions = (".eps", ".ps", ".pdf", ".png", ".bmp", ".jpg", ".jpeg",
".png", ".tiff", ".fig", ".svg", ".wmf")
extensions = (".pdf", ".png", ".bmp", ".jpg", ".jpeg", ".png",
".tiff", ".fig", ".svg", ".wmf", ".eps", ".ps")
qtext = "*" + " *".join(extensions)
filepath = QtGui.QFileDialog.getSaveFileName(self, "Save Image",
".", "Image Files ({})".format(qtext))
".", "Image Files ({})".format(qtext))
if len(filepath) == 0:
return
gr.beginprint(filepath)
self.draw()
if filepath.endswith('.eps') or filepath.endswith('.ps'):
gr.beginprintext(filepath, 'Color', 'A4', 'Landscape')
self.draw(now=True, wsviewport=(0, 0.297*0.9, 0, 0.21*0.95))
else:
gr.beginprint(filepath)
self.draw(now=True)
gr.endprint()
def refresh(self):
......@@ -199,7 +215,7 @@ class RDFWidget(QtGui.QWidget):
if results.domains is not None \
and len(results.domains.centers) > 0 \
and "cav" not in e:
e.append("cav")
e.append("cavity domain centers")
self.elem1.clear()
self.elem1.addItems(e)
self.elem2.clear()
......
This diff is collapsed.
......@@ -12,6 +12,10 @@
<div id="content">
<div class="headline">Summary of Domain Center-based Cavities</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>number of cavities: </strong></td>
<td>{{ "%d"|format(number) }}</td>
</tr>
<tr>
<td><strong>sum of surface area: </strong></td>
<td>{{ "%.4f"|format(surface_area) }} &#x212b; <sup>2</sup></td>
......
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>{{ title }}</title>
<meta name="description" content="{{ description }}"/>
</head>
<body>
<div id="content">
<div class="headline">Summary of Domain Center-based Cavities</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>Domain Center-based Cavities have not yet been calculated.</strong></td>
</tr>
</table>
</div>
</body>
</html>
......@@ -12,6 +12,10 @@
<div id="content">
<div class="headline">Summary of Domain Surface-based Cavities</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>number of cavities: </strong></td>
<td>{{ "%d"|format(number) }}</td>
</tr>
<tr>
<td><strong>sum of surface area: </strong></td>
<td>{{ "%.4f"|format(surface_area) }} &#x212b; <sup>2</sup></td>
......
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>{{ title }}</title>
<meta name="description" content="{{ description }}"/>
</head>
<body>
<div id="content">
<div class="headline">Summary of Domain Surface-based Cavities</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>Domain Surface-based Cavities have not yet been calculated.</strong></td>
</tr>
</table>
</div>
</body>
</html>
......@@ -13,7 +13,11 @@
<div class="headline">Summary of Cavities (Domains)</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>sum of surfaces: </strong></td>
<td><strong>number of cavities: </strong></td>
<td>{{ "%d"|format(number) }}</td>
</tr>
<tr>
<td><strong>sum of surface area: </strong></td>
<td> {{ "%.4f"|format(surface_area) }} &#x212b; <sup>2</sup></td>
</tr>
<tr>
......
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>{{ title }}</title>
<meta name="description" content="{{ description }}"/>
</head>
<body>
<div id="content">
<div class="headline">Summary of Cavities (Domains)</div>
<table class="table_margin_upper_table">
<tr>
<td><strong>Cavity Domains have not yet been calculated.</strong></td>
</tr>
</table>
</div>
</body>
</html>
......@@ -93,10 +93,16 @@ class TreeList(QtGui.QTreeWidget):
self.atom_list = ["Atom %d" % (i+1) for i in range(self.atoms.number)]
if self.cavities_center is not None:
self.cavities_center_list = ["Cavity %d" % (i+1) for i in range(len(self.cavities_center.multicavities))]
else:
self.cavities_center_list = []
if self.cavities_surface is not None:
self.cavities_surface_list = ["Cavity %d" % (i+1) for i in range(len(self.cavities_surface.multicavities))]
else:
self.cavities_surface_list = []
if self.domains is not None:
self.domains_list = ["Cavity %d" % (i+1) for i in range(self.domains.number)]
else:
self.domains_list = []
#print dir(atoms)
#print atoms.positions
#print atoms.elements
......
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