26 from datetime
import datetime
28 from datetime
import datetime
29 from PyQt5
import QtCore, QtWidgets, QtGui
30 from .gradient_info_handler
import GradientInfoHandler
31 from .gradient_list_model
import GradientListModel
38 gradientSelected = QtCore.pyqtSignal(object, name=
"gradientSelected")
40 def __init__(self, gradient_edit, parent=None):
41 QtWidgets.QWidget.__init__(self, parent)
44 self.
text_text_ =
"Gradient Presets"
55 self.
list_view_list_view_.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
57 preset_label = QtWidgets.QLabel(self.
text_text_)
58 font = preset_label.font()
62 self.
add_actionadd_action.setIcon(QtGui.QIcon(GradientPresetWidget.ICONS_DIR+
"add_icon.png"))
67 self.
add_button_add_button_.setIconSize(QtCore.QSize(20,20))
70 grid = QtWidgets.QGridLayout()
71 grid.setContentsMargins(0,5,0,0)
72 grid.addWidget(preset_label, 0, 0, 1, 1)
73 qhbox = QtWidgets.QHBoxLayout()
74 grid.addWidget(self.
list_view_list_view_,1,0,3,3)
78 self.
list_view_list_view_.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
93 self.
contextMenu_contextMenu_ = QtWidgets.QMenu(
"Context menu", self)
105 index = self.
list_view_list_view_.indexAt(pos)
107 if self.
list_model_list_model_.IsEditable(index.row()):
108 self.
contextMenu_contextMenu_.popup(QtWidgets.QCursor.pos())
113 if(self.
list_view_list_view_.currentIndex().isValid()):
116 if self.
list_model_list_model_.AddItem(datetime.now().isoformat(
' '), self.
gradient_edit_gradient_edit_.GetGradient(), row,
True,
True):
118 self.
list_view_list_view_.setCurrentIndex(index)
121 QtWidgets.QMessageBox.information(self,
"Gradient not added",
"The gradient could not be added!")
124 if(self.
list_view_list_view_.currentIndex().isValid()):
125 ret = QtWidgets.QMessageBox.warning(self,
"Delete Gradient",
127 QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
128 if ret == QtWidgets.QMessageBox.Yes:
132 if(self.
list_view_list_view_.currentIndex().isValid()):
140 if(self.
list_view_list_view_.currentIndex().isValid()):
144 return self.
text_text_
String DLLEXPORT_OST_BASE GetSharedDataPath()