def __init__(self, parent=None, connector=None): ''''Initialize dialog with *parent* and *connector* instance.''' if not connector: raise ValueError( 'Please provide a connector object for {0}'.format( self.__class__.__name__)) self.connector = connector if not parent: self.parent = self.connector.getMainWindow() super(FtrackTasksDialog, self).__init__(self.parent) applyTheme(self, 'integration') self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.setMinimumWidth(500) self.centralwidget = QtWidgets.QWidget(self) self.verticalMainLayout = QtWidgets.QVBoxLayout(self) self.horizontalLayout = QtWidgets.QHBoxLayout() self.headerWidget = Header(getpass.getuser(), self) self.headerWidget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.verticalMainLayout.addWidget(self.headerWidget) self.tasksWidget = WebViewWidget(self) url = ftrack.getWebWidgetUrl('tasks', theme='tf') self.tasksWidget.setUrl(url) self.horizontalLayout.addWidget(self.tasksWidget) self.verticalMainLayout.addLayout(self.horizontalLayout) self.setObjectName('ftrackTasks') self.setWindowTitle("ftrackTasks")
class FtrackTasksDialog(QtGui.QDialog): def __init__(self, parent=None, connector=None): ''''Initialize dialog with *parent* and *connector* instance.''' if not connector: raise ValueError( 'Please provide a connector object for {0}'.format( self.__class__.__name__ ) ) self.connector = connector if not parent: self.parent = self.connector.getMainWindow() super(FtrackTasksDialog, self).__init__(self.parent) applyTheme(self, 'integration') self.setSizePolicy( QtGui.QSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding ) ) self.setMinimumWidth(500) self.centralwidget = QtGui.QWidget(self) self.verticalMainLayout = QtGui.QVBoxLayout(self) self.horizontalLayout = QtGui.QHBoxLayout() self.headerWidget = Header(getpass.getuser(), self) self.headerWidget.setSizePolicy( QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed ) self.verticalMainLayout.addWidget(self.headerWidget) self.tasksWidget = WebViewWidget(self) url = ftrack.getWebWidgetUrl('tasks', theme='tf') self.tasksWidget.setUrl(url) self.horizontalLayout.addWidget(self.tasksWidget) self.verticalMainLayout.addLayout(self.horizontalLayout) self.setObjectName('ftrackTasks') self.setWindowTitle("ftrackTasks") def keyPressEvent(self, e): '''Handle the key press Event''' if not e.key() == QtCore.Qt.Key_Escape: super(FtrackTasksDialog, self).keyPressEvent(e)
def __init__(self, parent=None): '''Initialise widget with *parent*.''' super(NukeCrew, self).__init__(parent=parent) ftrack_connect.ui.theme.applyTheme(self, 'integration') self.setMinimumWidth(400) self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.vertical_layout = QtWidgets.QVBoxLayout(self) self.horizontal_layout = QtWidgets.QHBoxLayout() self.header = Header(username=getpass.getuser(), parent=self) self.vertical_layout.addWidget(self.header) self.notification_list = _notification_list.Notification(self) self._hub = ftrack_connect_nuke.crew_hub.crew_hub self._classifier = UserClassifier() self._classifier.update_context(self._read_context_from_environment()) current_user = ftrack.getUser(getpass.getuser()) groups = ['Assigned', 'Contributors', 'Supervisors'] self.chat = _crew.Crew(groups, current_user, hub=self._hub, classifier=self._classifier, parent=self) self.chat.chat.busyOverlay.setStyleSheet(NUKE_OVERLAY_STYLE) added_user_ids = [] for _user in session.query('select id, username, first_name, last_name' ' from User where is_active is True'): if _user['id'] != current_user.getId(): self.chat.addUser( u'{0} {1}'.format(_user['first_name'], _user['last_name']), _user['id']) added_user_ids.append(_user['id']) self.tab_panel = QtWidgets.QTabWidget(parent=self) self.tab_panel.addTab(self.chat, 'Chat') self.tab_panel.addTab(self.notification_list, 'Notifications') self.horizontal_layout.addWidget(self.tab_panel) # TODO: This styling should probably be done in a global stylesheet # for the entire Nuke plugin. self.notification_list.overlay.setStyleSheet(NUKE_OVERLAY_STYLE) self.vertical_layout.setContentsMargins(0, 0, 0, 0) self.vertical_layout.addLayout(self.horizontal_layout) self.setObjectName('Crew') self.setWindowTitle('Crew') # Import inline to avoid mysterious segfault in nuke 9.1dev build. from ftrack_connect.connector.panelcom import (PanelComInstance as _PanelComInstance) panel_communication_singleton = _PanelComInstance.instance() panel_communication_singleton.addRefreshListener(self.on_refresh_event) self.on_refresh_event() if not self._hub.compatibleServerVersion: logging.info('Incompatible server version.') self.blockingOverlay = ftrack_connect.ui.widget.overlay.BlockingOverlay( self, message='Incompatible server version.') self.blockingOverlay.setStyleSheet(NUKE_OVERLAY_STYLE) self.blockingOverlay.show() else: self._hub.populateUnreadConversations(current_user.getId(), added_user_ids)