Esempio n. 1
0
    def __init__(self, record, libraryWidget=None):
        """
        :type record: Record
        :type libraryWidget: studiolibrary.LibraryWidget
        """
        QtGui.QWidget.__init__(self, None)
        studiolibrary.loadUi(self)

        self._scriptJob = None
        self._record = record
        self._iconPath = ""
        self._libraryWidget = libraryWidget

        self.loadSettings()

        if studiolibrary.isPySide():
            self.layout().setContentsMargins(0, 0, 0, 0)

        if hasattr(self.ui, 'title'):
            self.ui.title.setText(self.record().plugin().name())

        if hasattr(self.ui, 'name'):
            self.ui.name.setText(self.record().name())

        if hasattr(self.ui, 'owner'):
            self.ui.owner.setText(str(self.record().owner()))

        if hasattr(self.ui, 'comment'):
            if isinstance(self.ui.comment, QtGui.QLabel):
                self.ui.comment.setText(self.record().description())
            else:
                self.ui.comment.setPlainText(self.record().description())

        if hasattr(self.ui, "contains"):
            self.updateContains()

        if hasattr(self.ui, 'snapshotButton'):
            path = self.record().iconPath()
            if os.path.exists(path):
                self.setIconPath(self.record().iconPath())

        ctime = self.record().ctime()
        if hasattr(self.ui, 'created') and ctime:
            self.ui.created.setText(studiolibrary.timeAgo(str(ctime)))

        try:
            self.selectionChanged()
            self._scriptJob = mutils.ScriptJob(e=['SelectionChanged', self.selectionChanged])
        except NameError:
            import traceback
            traceback.print_exc()
Esempio n. 2
0
 def _showInfoWidget(self):
     record = self._currentRecord
     parent = self.infoWindow().ui.mainFrame
     self.deleteChildren(parent)
     widget = self.infoWidget(parent, record)
     if widget:
         width = 190
         height = 80
         if studiolibrary.isPySide():
             self.infoWindow().setFixedWidth(width)
             self.infoWindow().setFixedHeight(height)
         else:
             widget.parent().setFixedWidth(width)
             widget.parent().setFixedHeight(height)
         self.infoWindow().show()
Esempio n. 3
0
 def _showInfoWidget(self):
     record = self._currentRecord
     parent = self.infoWindow().ui.mainFrame
     self.deleteChildren(parent)
     widget = self.infoWidget(parent, record)
     if widget:
         width = 190
         height = 80
         if studiolibrary.isPySide():
             self.infoWindow().setFixedWidth(width)
             self.infoWindow().setFixedHeight(height)
         else:
             widget.parent().setFixedWidth(width)
             widget.parent().setFixedHeight(height)
         self.infoWindow().show()
Esempio n. 4
0
    def __init__(self, parent=None, record=None):
        """
        @param parent: QtGui.QWidget
        @param record:
        """
        QtGui.QWidget.__init__(self, parent)
        studiolibrary.loadUi(self)

        self._record = record
        self.loadSettings()

        if studiolibrary.isPySide():
            self.layout().setContentsMargins(0, 0, 0, 0)

        if hasattr(self.ui, 'title'):
            self.ui.title.setText(self.record().plugin().name())

        if hasattr(self.ui, 'name'):
            self.ui.name.setText(self.record().name())

        if hasattr(self.ui, 'owner'):
            self.ui.owner.setText(str(self.record().owner()))

        if hasattr(self.ui, 'comment'):
            if isinstance(self.ui.comment, QtGui.QLabel):
                self.ui.comment.setText(self.record().description())
            else:
                self.ui.comment.setPlainText(self.record().description())

        if hasattr(self.ui, "contains"):
            self.updateContains()

        if hasattr(self.ui, 'snapshotButton'):
            self.setSnapshot(self.record().icon())

        ctime = self.record().ctime()
        if hasattr(self.ui, 'created') and ctime:
            self.ui.created.setText(studiolibrary.timeAgo(str(ctime)))

        try:
            self._scriptJob = None
            self._scriptJob = mutils.ScriptJob(
                e=['SelectionChanged', self.selectionChanged])
            self.selectionChanged()
        except NameError:
            import traceback
            traceback.print_exc()
    def __init__(self, parent=None, record=None):
        """
        @param parent: QtGui.QWidget
        @param record:
        """
        QtGui.QWidget.__init__(self, parent)
        studiolibrary.loadUi(self)

        self._record = record
        self.loadSettings()

        if studiolibrary.isPySide():
            self.layout().setContentsMargins(0, 0, 0, 0)

        if hasattr(self.ui, 'title'):
            self.ui.title.setText(self.record().plugin().name())

        if hasattr(self.ui, 'name'):
            self.ui.name.setText(self.record().name())

        if hasattr(self.ui, 'owner'):
            self.ui.owner.setText(str(self.record().owner()))

        if hasattr(self.ui, 'comment'):
            if isinstance(self.ui.comment, QtGui.QLabel):
                self.ui.comment.setText(self.record().description())
            else:
                self.ui.comment.setPlainText(self.record().description())

        if hasattr(self.ui, "contains"):
            self.updateContains()

        if hasattr(self.ui, 'snapshotButton'):
            self.setSnapshot(self.record().icon())

        ctime = self.record().ctime()
        if hasattr(self.ui, 'created') and ctime:
            self.ui.created.setText(studiolibrary.timeAgo(str(ctime)))

        try:
            self._scriptJob = None
            self._scriptJob = mutils.ScriptJob(e=['SelectionChanged', self.selectionChanged])
            self.selectionChanged()
        except NameError:
            import traceback
            traceback.print_exc()