def init(self): titleBar = self.titleBarWidget() self.__state_filter = CheckableComboBox("Task States", constants.TASK_STATES, parent=self) self.__layer_filter = CheckableComboBox("Layers", [], parent=self) titleBar.addWidget(self.__state_filter) titleBar.addWidget(self.__layer_filter) self.__state_filter.optionSelected.connect(self.__stateFilterChanged) self.__layer_filter.optionSelected.connect(self.__layerFilterChanged)
class TaskPanel(Panel): def __init__(self, name="Tasks", parent=None): Panel.__init__(self, name, "Tasks", parent) self.setAttr("refreshSeconds", 5) self.setWidget(TaskWidget(self.attrs, self)) self.setWindowTitle(name) self.__lastJobId = None EventManager.bind("JOB_OF_INTEREST", self.__handleJobOfInterestEvent) def init(self): titleBar = self.titleBarWidget() self.__state_filter = CheckableComboBox("Task States", constants.TASK_STATES, parent=self) self.__layer_filter = CheckableComboBox("Layers", [], parent=self) titleBar.addWidget(self.__state_filter) titleBar.addWidget(self.__layer_filter) self.__state_filter.optionSelected.connect(self.__stateFilterChanged) self.__layer_filter.optionSelected.connect(self.__layerFilterChanged) def openLoadDialog(self): print "Open search dialog" def openConfigDialog(self): pass def refresh(self): self.widget().refresh() def __handleJobOfInterestEvent(self, *args, **kwargs): jobId = args[0] taskWidget = self.widget() taskWidget.setJobId(args[0]) if jobId != self.__lastJobId: self.__layer_filter.setOptions(taskWidget.layerNames) self.__lastJobId = jobId def __stateFilterChanged(self): sel = self.__state_filter.selectedOptions() self.widget().setStateFilters(sel) def __layerFilterChanged(self): sel = self.__layer_filter.selectedOptions() self.widget().setLayerFilters(sel)
def init(self): titleBar = self.titleBarWidget() titleBar.addAction(QtGui.QIcon(":/images/locked.png"), "Lock Selected Nodes", partial(self.__setNodesLocked, True)) titleBar.addAction(QtGui.QIcon(":/images/unlocked.png"), "Unlock Selected Nodes", partial(self.__setNodesLocked, False)) self.__cluster_filter = CheckableComboBox("Clusters", [], parent=self) titleBar.addWidget(self.__cluster_filter) self.__cluster_filter.optionSelected.connect(self.__clusterFilterChanged)
class NodePanel(Panel): def __init__(self, name="Nodes", parent=None): Panel.__init__(self, name, "Nodes", parent) self.setAttr("refreshSeconds", 10) self.setWidget(NodeWidget(self.attrs, self)) self.setWindowTitle(name) def init(self): titleBar = self.titleBarWidget() titleBar.addAction(QtGui.QIcon(":/images/locked.png"), "Lock Selected Nodes", partial(self.__setNodesLocked, True)) titleBar.addAction(QtGui.QIcon(":/images/unlocked.png"), "Unlock Selected Nodes", partial(self.__setNodesLocked, False)) self.__cluster_filter = CheckableComboBox("Clusters", [], parent=self) titleBar.addWidget(self.__cluster_filter) self.__cluster_filter.optionSelected.connect(self.__clusterFilterChanged) def refresh(self): clusters = plow.client.get_clusters() names = sorted(c.name for c in clusters) nodeWidget = self.widget() nodeWidget.refresh() nodeWidget.setClusterList(clusters) filt = self.__cluster_filter sel = filt.selectedOptions() filt.setOptions(names, selected=sel) def __setNodesLocked(self, locked): try: for node in self.widget().getSelectedNodes(): node.lock(locked) finally: self.refresh() def __clusterFilterChanged(self): sel = self.__cluster_filter.selectedOptions() self.widget().setClusterFilters(sel)