def iconPath(self): """ :rtype: str """ iconPath = self._settings.get('iconPath', None) index = self.treeWidget().indexFromPath(self.path()) expanded = self.treeWidget().isExpanded(index) if not iconPath: if 'Trash' in self.name(): iconPath = studioqt.resource().get('icons', 'delete') elif expanded: iconPath = studioqt.resource().get('icons', 'folder_open') else: iconPath = studioqt.resource().get('icons', 'folder') return iconPath
def clear(self): self._timer.stop() self._button.hide() self._label.setText("") self._label.setStyleSheet("") icon = studioqt.resource().icon("blank") self._button.setIcon(icon)
def setIcon(self, column, icon, color=None): """ Set the icon to be displayed in the given column. :type column: int or str :type icon: QtGui.QIcon :rtype: None """ # Safe guard for when the class is being used without the gui. isAppRunning = bool(QtWidgets.QApplication.instance()) if not isAppRunning: return if isinstance(icon, basestring): if not os.path.exists(icon): color = color or studioqt.Color(255, 255, 255, 20) icon = studioqt.resource().icon("image", color=color) else: icon = QtGui.QIcon(icon) if isinstance(column, basestring): self._icon[column] = icon else: self._pixmap[column] = None QtWidgets.QTreeWidgetItem.setIcon(self, column, icon)
def thumbnailPath(self): """ Return the thumbnail location on disc for this item. :rtype: str """ return studioqt.resource().get("icons", "thumbnail.png")
def clear(self): self._timer.stop() self._button.hide() self._label.setText('') self._label.setStyleSheet('') icon = studioqt.resource().icon('blank') self._button.setIcon(icon)
def thumbnailPath(self): """ Return the thumbnail location on disc for this item. :type libraryWidget: studiolibrary.LibraryWidget :rtype: QtWidgets.QWidget """ return studioqt.resource().get("icons", "thumbnail.png")
def setInfo(self, text, msec=DISPLAY_TIME): icon = studioqt.resource().icon("info") self._button.setIcon(icon) self._button.show() self._label.setStyleSheet("background-color: rgb(0, 0, 0, 0);") self.setText(text, msec)
def iconPath(self): """ :rtype: str """ iconPath = self._settings.get("iconPath", None) index = self.treeWidget().indexFromPath(self.path()) expanded = self.treeWidget().isExpanded(index) if not iconPath: if "Trash" in self.name(): iconPath = studioqt.resource().get("icons", "delete") elif expanded: iconPath = studioqt.resource().get("icons", "folder_open") else: iconPath = studioqt.resource().get("icons", "folder") return iconPath
def setWarning(self, text, msec=DISPLAY_TIME): icon = studioqt.resource().icon("warning") self._button.setIcon(icon) self._button.show() self._label.setStyleSheet( "color: rgb(222, 180, 0);background-color: rgb(0, 0, 0, 0);") self.setText(text, msec)
def styleSheet(self): """ Return the style sheet for this theme. :rtype: str """ options = self.options() path = studioqt.resource().get('css', 'default.css') styleSheet = studioqt.StyleSheet.fromPath(path, options=options, dpi=self.dpi()) return styleSheet.data()
def pixmap(self): """ :rtype: QtGui.QPixmap """ if not self.isIconVisible(): return studioqt.resource().pixmap("") color = self.color() iconPath = self.iconPath() self._pixmap = studioqt.Pixmap(iconPath) if color: self._pixmap.setColor(color) return self._pixmap
def setIcon(self, column, icon, color=None): """ Set the icon to be displayed in the given column. :type column: int or str :type icon: QtGui.QIcon :rtype: None """ if isinstance(icon, basestring): if not os.path.exists(icon): color = color or studioqt.Color(255, 255, 255, 20) icon = studioqt.resource().icon('image', color=color) else: icon = QtGui.QIcon(icon) if isinstance(column, basestring): self._icon[column] = icon else: self._pixmap[column] = None QtWidgets.QTreeWidgetItem.setIcon(self, column, icon)
def setIcon(self, column, icon, color = None): """ Set the icon to be displayed in the given column. :type column: int or str :type icon: QtGui.QIcon :rtype: None """ if isinstance(icon, basestring): if not os.path.exists(icon): color = color or studioqt.Color(255, 255, 255, 20) icon = studioqt.resource().icon('image', color=color) else: icon = QtGui.QIcon(icon) if isinstance(column, basestring): self._icon[column] = icon else: self._pixmap[column] = None QtWidgets.QTreeWidgetItem.setIcon(self, column, icon)
def setError(self, text, msec = DISPLAY_TIME): icon = studioqt.resource().icon('error') self._button.setIcon(icon) self._button.show() self._label.setStyleSheet('color: rgb(222, 0, 0);background-color: rgb(0, 0, 0, 0);') self.setText(text, msec)
def setWarning(self, text, msec = DISPLAY_TIME): icon = studioqt.resource().icon('warning') self._button.setIcon(icon) self._button.show() self._label.setStyleSheet('color: rgb(222, 180, 0);background-color: rgb(0, 0, 0, 0);') self.setText(text, msec)
def setInfo(self, text, msec = DISPLAY_TIME): icon = studioqt.resource().icon('info') self._button.setIcon(icon) self._button.show() self._label.setStyleSheet('background-color: rgb(0, 0, 0, 0);') self.setText(text, msec)