move to listwidget

This commit is contained in:
Dominik Demuth 2023-03-13 17:59:12 +01:00
parent b31dec4c7b
commit 62f3839b20
3 changed files with 15 additions and 14 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'src/resources/_ui/basewindow.ui' # Form implementation generated from reading ui file '/autohome/dominik/nmreval-gitea/src/resources/_ui/basewindow.ui'
# #
# Created by: PyQt5 UI code generator 5.15.7 # Created by: PyQt5 UI code generator 5.15.7
# #
@ -568,6 +568,7 @@ class Ui_BaseWindow(object):
self.actionTile.setText(_translate("BaseWindow", "Tile windows")) self.actionTile.setText(_translate("BaseWindow", "Tile windows"))
self.actionMinimize.setText(_translate("BaseWindow", "Minimize")) self.actionMinimize.setText(_translate("BaseWindow", "Minimize"))
self.actionNew_window.setText(_translate("BaseWindow", "New graph")) self.actionNew_window.setText(_translate("BaseWindow", "New graph"))
self.actionNew_window.setShortcut(_translate("BaseWindow", "Ctrl+N"))
self.actionDelete_window.setText(_translate("BaseWindow", "Delete graph")) self.actionDelete_window.setText(_translate("BaseWindow", "Delete graph"))
self.actionCascade_windows.setText(_translate("BaseWindow", "Cascade windows")) self.actionCascade_windows.setText(_translate("BaseWindow", "Cascade windows"))
self.actionNext_window.setText(_translate("BaseWindow", "Next")) self.actionNext_window.setText(_translate("BaseWindow", "Next"))
@ -582,6 +583,7 @@ class Ui_BaseWindow(object):
self.action_mean_t1.setText(_translate("BaseWindow", "Convert mean values...")) self.action_mean_t1.setText(_translate("BaseWindow", "Convert mean values..."))
self.actionFilon.setText(_translate("BaseWindow", "Log FT...")) self.actionFilon.setText(_translate("BaseWindow", "Log FT..."))
self.action_new_set.setText(_translate("BaseWindow", "New set")) self.action_new_set.setText(_translate("BaseWindow", "New set"))
self.action_new_set.setShortcut(_translate("BaseWindow", "Ctrl+Shift+N"))
self.action_magnitude.setText(_translate("BaseWindow", "Calculate magnitude")) self.action_magnitude.setText(_translate("BaseWindow", "Calculate magnitude"))
self.actionCenterMax.setText(_translate("BaseWindow", "Center on max")) self.actionCenterMax.setText(_translate("BaseWindow", "Center on max"))
self.action_depake.setText(_translate("BaseWindow", "De-paked spectrum")) self.action_depake.setText(_translate("BaseWindow", "De-paked spectrum"))

View File

@ -37,20 +37,13 @@ class DrawingsWidget(QtWidgets.QWidget, Ui_Form):
QtWidgets.QMessageBox.information(self, 'Not working', 'Something is missing to create this object') QtWidgets.QMessageBox.information(self, 'Not working', 'Something is missing to create this object')
return return
idx = self.treeWidget.selectedIndexes() new_obj = [LineObject, MultipointObject, TextObject, RectangleObject, EllipseObject][self.mode_comboBox.currentIndex()](**dic)
if idx: graph_id = self.graph_combobox.currentData()
idx = idx[0]
new_obj = [LineObject, MultipointObject, TextObject, RectangleObject, EllipseObject][self.mode_comboBox.currentIndex()](**dic)
item = self.treeWidget.itemFromIndex(idx)
graph_id = item.data(0, QtCore.Qt.UserRole)
child = QtWidgets.QTreeWidgetItem([str(new_obj)])
child.setData(0, QtCore.Qt.UserRole, new_obj.id)
item.addChild(child) child = QtWidgets.QListWidgetItem(str(new_obj))
child.setData(QtCore.Qt.UserRole, new_obj.id)
self.listWidget.addItem(child)
self.graphs[graph_id].addDrawing(new_obj) self.graphs[graph_id].addDrawing(new_obj)
else:
QtWidgets.QMessageBox.information(self, 'Not working', 'No graph is selected to add this object.')
self.treeWidget.expandAll()

View File

@ -757,6 +757,9 @@
<property name="text"> <property name="text">
<string>New graph</string> <string>New graph</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action> </action>
<action name="actionDelete_window"> <action name="actionDelete_window">
<property name="text"> <property name="text">
@ -823,6 +826,9 @@
<property name="text"> <property name="text">
<string>New set</string> <string>New set</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+Shift+N</string>
</property>
</action> </action>
<action name="action_magnitude"> <action name="action_magnitude">
<property name="text"> <property name="text">