Commit 1258436c authored by Lars Bittrich's avatar Lars Bittrich

Bugfixes in AnalysisView, ParticleTypeView, and ExpExcelDialog

parent 04b35ae2
...@@ -588,7 +588,7 @@ class ParticleAnalysis(QtWidgets.QMainWindow): ...@@ -588,7 +588,7 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
print("abundancyList:", abundancyList) print("abundancyList:", abundancyList)
print("labelList:", labelList) print("labelList:", labelList)
print("colorList:", colorList) print("colorList:", colorList)
self.typeHistogram.updateTypes(list(zip(abundancyList, labelList, colorList))) self.typeHistogram.updateTypes(list(zip(abundancyList, labelList, colorList)))
#general size histogram #general size histogram
self.sizeHist_ax.clear() self.sizeHist_ax.clear()
......
...@@ -155,7 +155,7 @@ class ExpExcelDialog(QtWidgets.QDialog): ...@@ -155,7 +155,7 @@ class ExpExcelDialog(QtWidgets.QDialog):
if not os.path.exists(xlsname): if not os.path.exists(xlsname):
validFileName = True validFileName = True
else: else:
xlsname = self.directory + self.xlsFileName.text() + ' {}.xlsx'.format(incr) xlsname = self.directory + '//' + self.xlsFileName.text() + ' {}.xlsx'.format(incr)
incr += 1 incr += 1
writer = pd.ExcelWriter(xlsname, engine = 'xlsxwriter') writer = pd.ExcelWriter(xlsname, engine = 'xlsxwriter')
...@@ -220,16 +220,24 @@ class ParticleIndicator(QtWidgets.QPushButton): ...@@ -220,16 +220,24 @@ class ParticleIndicator(QtWidgets.QPushButton):
qp = QtGui.QPainter() qp = QtGui.QPainter()
qp.begin(self) qp.begin(self)
qp.fillRect(self.rect(), QtCore.Qt.white) #qp.fillRect(self.rect(), QtCore.Qt.white)
qp.setBrush(QtCore.Qt.white)
qp.drawRoundedRect(0, 0, width, height, 5. ,5.)
qp.setPen(self.color) qp.setPen(self.color)
qp.setBrush(self.color) qp.setBrush(self.color)
qp.drawRoundedRect(0, 0, int(width*r), height, 5. ,5.) qp.drawRoundedRect(0, 0, int(width*r), height, 5. ,5.)
qp.setPen(QtCore.Qt.black) qp.setPen(QtCore.Qt.black)
qp.setBrush(QtCore.Qt.NoBrush) qp.setBrush(QtCore.Qt.NoBrush)
qp.drawRoundedRect(0, 0, width, height, 5. ,5.) qp.drawRoundedRect(0, 0, width, height, 5. ,5.)
qp.drawText(self.rect(), QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter, font = qp.font()
font.setPointSize(13)
font.setStyleStrategy(QtGui.QFont.NoAntialias)
font.setWeight(0)
qp.setFont(font)
qp.setCompositionMode(QtGui.QPainter.RasterOp_SourceXorDestination)
qp.setPen(QtCore.Qt.white)
qp.drawText(5, 0, width-10, height, QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter,
self.text) self.text)
qp.end() qp.end()
...@@ -252,12 +260,16 @@ class ParticleTypeView(QtWidgets.QScrollArea): ...@@ -252,12 +260,16 @@ class ParticleTypeView(QtWidgets.QScrollArea):
self.setWidgetResizable(True) self.setWidgetResizable(True)
self.setWidget(self.view) self.setWidget(self.view)
self.setAlignment(QtCore.Qt.AlignHCenter) self.setAlignment(QtCore.Qt.AlignHCenter)
self.widgets = []
def updateTypes(self, types): def updateTypes(self, types):
print("Updating polymer type view", flush=True) print("Updating polymer type view", flush=True)
for i in range(self.indicatorbox.count()): for pi in self.widgets:
self.indicatorbox.takeAt(0) self.indicatorbox.removeWidget(pi)
pi.setParent(None)
pi.destroy()
self.indicatorbox.takeAt(0)
self.widgets = []
numtotal = sum([num for num, text, color in types]) numtotal = sum([num for num, text, color in types])
def getIndexFunction(index): def getIndexFunction(index):
...@@ -269,6 +281,7 @@ class ParticleTypeView(QtWidgets.QScrollArea): ...@@ -269,6 +281,7 @@ class ParticleTypeView(QtWidgets.QScrollArea):
pi = ParticleIndicator(num, numtotal, color, text) pi = ParticleIndicator(num, numtotal, color, text)
self.indicatorbox.addWidget(pi) self.indicatorbox.addWidget(pi)
pi.clicked.connect(getIndexFunction(index)) pi.clicked.connect(getIndexFunction(index))
self.widgets.append(pi)
self.indicatorbox.addStretch() self.indicatorbox.addStretch()
self.view.update() self.view.update()
\ No newline at end of file
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