Commit 0c00d265 authored by 3Yan's avatar 3Yan
Browse files

DRL - improved clipboard operations

parent 967c266c
......@@ -99,11 +99,9 @@ def main():
graph = Figure(figsize=(5, 4), dpi=100, facecolor="None")
grid = graph.add_gridspec(2, 1)
chromatogram = graph.add_subplot(grid[0,0], facecolor=(1, 1, 1, 0.8))
spectrum = graph.add_subplot(grid[1,0], facecolor=(1, 1, 1, 0.8))
graph.tight_layout()
mpl_canvas = FigureCanvas(graph)
mpl_canvas.setStyleSheet("background-color:transparent;")
mpl_canvas.setAutoFillBackground(False)
......
......@@ -239,7 +239,8 @@ def corr_changed(correction, ds, drls, drlspectrum):
def corcount_changed(ds, drls, drlspectrum):
"""routine called by change of the correction factors count"""
logger.info('''change in the correction count detected''')
diff = int(drls['cors'].value() - ((drls['dt'].columnCount() - 1) / 2))
diff = int(drls['cors'].value() -
((drls['dt'].columnCount() - 1) / 2))
if diff == 0:
return
elif diff > 0:
......@@ -252,6 +253,8 @@ def corcount_changed(ds, drls, drlspectrum):
drls['dt'].setCellWidget(
row, col, QtWidgets.QComboBox())
drls['dt'].cellWidget(row, col).setFrame(False)
drls['dt'].cellWidget(row, col).setFocusPolicy(
QtCore.Qt.NoFocus)
drls['dt'].setItem(
row, col+1, QtWidgets.QTableWidgetItem())
newcors.append(drls['dt'].cellWidget(row, col))
......@@ -336,6 +339,7 @@ def add_line(ds, drls, drlspectrum):
for i in range(drls['cors'].value()):
col = copy(1+i*2)
drls['dt'].setCellWidget(newrow, col, QtWidgets.QComboBox())
drls['dt'].cellWidget(newrow, col).setFocusPolicy(QtCore.Qt.NoFocus)
drls['dt'].cellWidget(newrow, col).setFrame(False)
drls['dt'].setItem(newrow, col+1, QtWidgets.QTableWidgetItem())
......@@ -522,6 +526,8 @@ def print_graph(labels, ds, drls):
def clip_range(drls):
"""copy selected part of the table"""
logger.debug("copying selected table cells to clipboard")
activeObject = QtWidgets.QApplication.focusWidget()
if activeObject in (drls['pt'], drls['dt']):
table = activeObject
......@@ -550,6 +556,7 @@ def clip_range(drls):
def paste_clip(ds, drls, drlspectrum):
logger.debug("pasting data from clipboard")
activeObject = QtWidgets.QApplication.focusWidget()
if activeObject in (drls['pt'], drls['dt'])\
and activeObject.selectedRanges() != []:
......@@ -559,6 +566,7 @@ def paste_clip(ds, drls, drlspectrum):
None, "Operation not supported",
"Operation not supported for multiple ranges,\n"
"cancelling request")
return
cliptext = QtWidgets.QApplication.clipboard().text()
rows = cliptext.split("\n")
startrow = table.selectedRanges()[0].topRow()
......
Supports Markdown
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