fixed typo in t1 calculation, extra context for graphs: fixes T242; fixes T245

This commit is contained in:
Dominik Demuth 2022-11-29 20:58:27 +01:00
parent 377454b683
commit b1e54c8432
4 changed files with 89 additions and 56 deletions

View File

@ -30,7 +30,7 @@ AppDir:
arch: amd64
allow_unauthenticated: true
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:
# for /usr/bin/env

View File

@ -306,15 +306,13 @@ class DataTree(QtWidgets.QTreeWidget):
iterator += 1
def contextMenuEvent(self, evt, color_list=None):
def contextMenuEvent(self, evt):
menu = QtWidgets.QMenu()
_ = menu.addAction('Hello')
_.setEnabled(False)
menu.addSeparator()
idx = self.selectedIndexes()
if self.invisibleRootItem().childCount() == 0 and len(idx) == 0:
if self.invisibleRootItem().childCount() == 0 and len(self.selectedIndexes()) == 0:
rdn_action = menu.addAction('Randomness')
action = menu.exec(evt.globalPos())
@ -323,67 +321,99 @@ class DataTree(QtWidgets.QTreeWidget):
import webbrowser
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:
del_action = menu.addAction('Exterminate')
cp_action = menu.addAction('Replicate')
cat_action = menu.addAction('Join us!')
plt_action = None
save_action = None
self.ctx_sets(evt, menu)
def ctx_graphs(self, evt, menu):
del_action = menu.addAction('Exterminate graph!')
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()
col_menu = menu.addMenu('Color cycle')
for c in available_cycles.keys():
col_menu.addAction(c)
plt_action = menu.addAction('Plot fit parameter')
save_action = menu.addAction('Save fit parameter')
idx = {}
has_fits = False
for i in self.selectedIndexes():
if i.column() == 0:
continue
action = menu.exec(evt.globalPos())
item = self.itemFromIndex(i)
parent = item.parent()
if parent is None:
continue
s = []
for gid, sets in idx.items():
s.extend(sets)
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 action == del_action:
self.management.delete_sets(s)
if has_fits:
menu.addSeparator()
plt_action = menu.addAction('Plot fit parameter')
save_action = menu.addAction('Save fit parameter')
action = menu.exec(evt.globalPos())
s = []
elif action == cp_action:
for gid, sets in idx.items():
s.extend(sets)
self.management.copy_sets(sets, gid)
if action == del_action:
self.management.delete_sets(s)
elif action == cat_action:
self.management.cat(s)
elif action == cp_action:
for gid, sets in idx.items():
self.management.copy_sets(sets, gid)
elif action == plt_action:
self.management.make_fit_parameter(s)
elif action == cat_action:
self.management.cat(s)
elif action == save_action:
self.saveFits.emit(s)
elif action == plt_action:
self.management.make_fit_parameter(s)
elif action == save_action:
self.saveFits.emit(s)
elif action.parent() == col_menu:
self.management.set_cycle(s, action.text())
elif action.parent() == col_menu:
self.management.set_cycle(s, action.text())
evt.accept()

View File

@ -291,6 +291,9 @@ class UpperManagement(QtCore.QObject):
self.undostack.endMacro()
def delete_graph(self, gid):
self.delete_sets(self.graphs[gid].sets + [gid])
@QtCore.pyqtSlot()
def cat(self, src_sets=None):
joined = None

View File

@ -87,7 +87,7 @@ class QRelaxCalc(QtWidgets.QDialog, Ui_Dialog):
else:
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):
self.arr_widget.setVisible(idx == 0)
self.vft_widget.setVisible(idx == 1)