forked from IPKM/nmreval
fixed typo in t1 calculation, extra context for graphs: fixes T242; fixes T245
This commit is contained in:
parent
377454b683
commit
b1e54c8432
@ -30,7 +30,7 @@ AppDir:
|
|||||||
arch: amd64
|
arch: amd64
|
||||||
allow_unauthenticated: true
|
allow_unauthenticated: true
|
||||||
sources:
|
sources:
|
||||||
- sourceline: 'deb [arch=amd64] http://mirror.infra.pkm/ bullseye main contrin non-free'
|
- sourceline: 'deb [arch=amd64] http://mirror.infra.pkm/ bullseye main contrib non-free'
|
||||||
|
|
||||||
include:
|
include:
|
||||||
# for /usr/bin/env
|
# for /usr/bin/env
|
||||||
|
@ -306,15 +306,13 @@ class DataTree(QtWidgets.QTreeWidget):
|
|||||||
|
|
||||||
iterator += 1
|
iterator += 1
|
||||||
|
|
||||||
def contextMenuEvent(self, evt, color_list=None):
|
def contextMenuEvent(self, evt):
|
||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
_ = menu.addAction('Hello')
|
_ = menu.addAction('Hello')
|
||||||
_.setEnabled(False)
|
_.setEnabled(False)
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
|
|
||||||
idx = self.selectedIndexes()
|
if self.invisibleRootItem().childCount() == 0 and len(self.selectedIndexes()) == 0:
|
||||||
|
|
||||||
if self.invisibleRootItem().childCount() == 0 and len(idx) == 0:
|
|
||||||
rdn_action = menu.addAction('Randomness')
|
rdn_action = menu.addAction('Randomness')
|
||||||
|
|
||||||
action = menu.exec(evt.globalPos())
|
action = menu.exec(evt.globalPos())
|
||||||
@ -323,67 +321,99 @@ class DataTree(QtWidgets.QTreeWidget):
|
|||||||
import webbrowser
|
import webbrowser
|
||||||
webbrowser.open('https://en.wikipedia.org/wiki/Special:Random')
|
webbrowser.open('https://en.wikipedia.org/wiki/Special:Random')
|
||||||
|
|
||||||
|
elif all([self.itemFromIndex(i).parent() is None for i in self.selectedIndexes()]):
|
||||||
|
# only graphs selected
|
||||||
|
self.ctx_graphs(evt, menu)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
del_action = menu.addAction('Exterminate')
|
self.ctx_sets(evt, menu)
|
||||||
cp_action = menu.addAction('Replicate')
|
|
||||||
cat_action = menu.addAction('Join us!')
|
def ctx_graphs(self, evt, menu):
|
||||||
plt_action = None
|
del_action = menu.addAction('Exterminate graph!')
|
||||||
save_action = None
|
col_menu = menu.addMenu('Color cycle')
|
||||||
|
for c in available_cycles.keys():
|
||||||
|
col_menu.addAction(c)
|
||||||
|
|
||||||
|
graphs = []
|
||||||
|
|
||||||
|
for i in self.selectedIndexes():
|
||||||
|
if i.column() == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
graphs.append(self.itemFromIndex(i).data(0, QtCore.Qt.UserRole))
|
||||||
|
|
||||||
|
action = menu.exec_(evt.globalPos())
|
||||||
|
if action == del_action:
|
||||||
|
for gid in graphs:
|
||||||
|
self.management.delete_graph(gid)
|
||||||
|
|
||||||
|
elif action.parent() == col_menu:
|
||||||
|
for gid in graphs:
|
||||||
|
self.management.set_cycle(self.management.graphs[gid].sets, action.text())
|
||||||
|
|
||||||
|
evt.accept()
|
||||||
|
|
||||||
|
def ctx_sets(self, evt, menu):
|
||||||
|
del_action = menu.addAction('Exterminate sets')
|
||||||
|
cp_action = menu.addAction('Replicate sets')
|
||||||
|
cat_action = menu.addAction('Join us!')
|
||||||
|
plt_action = None
|
||||||
|
save_action = None
|
||||||
|
menu.addSeparator()
|
||||||
|
col_menu = menu.addMenu('Color cycle')
|
||||||
|
for c in available_cycles.keys():
|
||||||
|
col_menu.addAction(c)
|
||||||
|
|
||||||
|
idx = {}
|
||||||
|
has_fits = False
|
||||||
|
for i in self.selectedIndexes():
|
||||||
|
if i.column() == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
item = self.itemFromIndex(i)
|
||||||
|
parent = item.parent()
|
||||||
|
if parent is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
else:
|
||||||
|
graph_id = parent.data(0, QtCore.Qt.UserRole)
|
||||||
|
if graph_id not in idx:
|
||||||
|
idx[graph_id] = []
|
||||||
|
# collect sets in their graph
|
||||||
|
idx[graph_id].append(item.data(0, QtCore.Qt.UserRole))
|
||||||
|
data = self.management[item.data(0, QtCore.Qt.UserRole)]
|
||||||
|
if data.mode == 'fit':
|
||||||
|
has_fits = True
|
||||||
|
|
||||||
|
if has_fits:
|
||||||
menu.addSeparator()
|
menu.addSeparator()
|
||||||
col_menu = menu.addMenu('Color cycle')
|
plt_action = menu.addAction('Plot fit parameter')
|
||||||
for c in available_cycles.keys():
|
save_action = menu.addAction('Save fit parameter')
|
||||||
col_menu.addAction(c)
|
|
||||||
|
|
||||||
idx = {}
|
action = menu.exec(evt.globalPos())
|
||||||
has_fits = False
|
|
||||||
for i in self.selectedIndexes():
|
|
||||||
if i.column() == 0:
|
|
||||||
continue
|
|
||||||
|
|
||||||
item = self.itemFromIndex(i)
|
s = []
|
||||||
parent = item.parent()
|
for gid, sets in idx.items():
|
||||||
if parent is None:
|
s.extend(sets)
|
||||||
continue
|
|
||||||
|
|
||||||
else:
|
if action == del_action:
|
||||||
graph_id = parent.data(0, QtCore.Qt.UserRole)
|
self.management.delete_sets(s)
|
||||||
if graph_id not in idx:
|
|
||||||
idx[graph_id] = []
|
|
||||||
# collect sets in their graph
|
|
||||||
idx[graph_id].append(item.data(0, QtCore.Qt.UserRole))
|
|
||||||
data = self.management[item.data(0, QtCore.Qt.UserRole)]
|
|
||||||
if data.mode == 'fit':
|
|
||||||
has_fits = True
|
|
||||||
|
|
||||||
if has_fits:
|
elif action == cp_action:
|
||||||
menu.addSeparator()
|
|
||||||
plt_action = menu.addAction('Plot fit parameter')
|
|
||||||
save_action = menu.addAction('Save fit parameter')
|
|
||||||
|
|
||||||
action = menu.exec(evt.globalPos())
|
|
||||||
|
|
||||||
s = []
|
|
||||||
for gid, sets in idx.items():
|
for gid, sets in idx.items():
|
||||||
s.extend(sets)
|
self.management.copy_sets(sets, gid)
|
||||||
|
|
||||||
if action == del_action:
|
elif action == cat_action:
|
||||||
self.management.delete_sets(s)
|
self.management.cat(s)
|
||||||
|
|
||||||
elif action == cp_action:
|
elif action == plt_action:
|
||||||
for gid, sets in idx.items():
|
self.management.make_fit_parameter(s)
|
||||||
self.management.copy_sets(sets, gid)
|
|
||||||
|
|
||||||
elif action == cat_action:
|
elif action == save_action:
|
||||||
self.management.cat(s)
|
self.saveFits.emit(s)
|
||||||
|
|
||||||
elif action == plt_action:
|
elif action.parent() == col_menu:
|
||||||
self.management.make_fit_parameter(s)
|
self.management.set_cycle(s, action.text())
|
||||||
|
|
||||||
elif action == save_action:
|
|
||||||
self.saveFits.emit(s)
|
|
||||||
|
|
||||||
elif action.parent() == col_menu:
|
|
||||||
self.management.set_cycle(s, action.text())
|
|
||||||
|
|
||||||
evt.accept()
|
evt.accept()
|
||||||
|
|
||||||
|
@ -291,6 +291,9 @@ class UpperManagement(QtCore.QObject):
|
|||||||
|
|
||||||
self.undostack.endMacro()
|
self.undostack.endMacro()
|
||||||
|
|
||||||
|
def delete_graph(self, gid):
|
||||||
|
self.delete_sets(self.graphs[gid].sets + [gid])
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def cat(self, src_sets=None):
|
def cat(self, src_sets=None):
|
||||||
joined = None
|
joined = None
|
||||||
|
@ -87,7 +87,7 @@ class QRelaxCalc(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
self.label_7.setText('\u03c9 / Hz')
|
self.label_7.setText('\u03c9 / Hz')
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int, name='on_temp_combobox_curr#entIndexChanged')
|
@QtCore.pyqtSlot(int, name='on_temp_combobox_currentIndexChanged')
|
||||||
def temp_combo_change(self, idx: int):
|
def temp_combo_change(self, idx: int):
|
||||||
self.arr_widget.setVisible(idx == 0)
|
self.arr_widget.setVisible(idx == 0)
|
||||||
self.vft_widget.setVisible(idx == 1)
|
self.vft_widget.setVisible(idx == 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user