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 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

View File

@ -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,9 +321,41 @@ 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')
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!') cat_action = menu.addAction('Join us!')
plt_action = None plt_action = None
save_action = None save_action = None

View File

@ -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

View File

@ -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)