Exemple #1
0
    def _redraw__Step(self):

        # Get step root
        _mode = self.ui.RootTabs.cur_text()
        if _mode == 'Assets':
            _root = get_single(self.ui.Asset.selected_data(), catch=True)
        elif _mode == 'Shots':
            _root = get_single(self.ui.Shot.selected_data(), catch=True)
        else:
            raise ValueError(_mode)
        _steps = _root.find_step_roots() if _root else []

        # Populate list
        _cur = self.ui.Step.selected_text(single=True)
        self.ui.Step.blockSignals(True)
        self.ui.Step.clear()
        _sel = _cur if _cur in _steps else None
        for _step in _steps:
            _work_area = _step.get_work_area(dcc=hb_utils.cur_dcc())
            _col = 'grey'
            if os.path.exists(_work_area.yaml):
                _col = 'white'
                _sel = _sel or _step
            _item = qt.HListWidgetItem(_step.step, data=_step)
            _item.set_col(_col)
            self.ui.Step.addItem(_item)
        if _sel:
            self.ui.Step.select_data([_sel])
        else:
            self.ui.Step.setCurrentRow(0)
        self.ui.Step.blockSignals(False)

        self._callback__Step()
Exemple #2
0
    def _redraw__assets(self, widget):
        _handler = self._get_handler()
        _mode = self.ui.mode.currentText()
        _shots = self.ui.shots.selected_data()
        _steps = self.ui.steps.selected_text()
        _tasks = self.ui.tasks.selected_text()
        if _mode == 'Shotgun':
            self._uncached_work_files = self._uncached_shots
        elif _mode == 'Disk':
            if self._uncached_shots:
                self._uncached_work_files = True
            else:
                self._uncached_work_files = bool(
                    _handler.find_work_files(shots=_shots,
                                             steps=_steps,
                                             tasks=_tasks,
                                             cached=False))
        else:
            raise ValueError(_mode)
        widget.setVisible(not self._uncached_work_files)
        self.ui.assets_stale.setVisible(self._uncached_work_files)
        if self._uncached_work_files:
            return

        for _asset in self._get_handler().find_assets(shots=_shots,
                                                      steps=_steps,
                                                      tasks=_tasks):
            _item = qt.HListWidgetItem(_asset.asset)
            _item.set_data(_asset)
            widget.addItem(_item)
Exemple #3
0
    def _redraw__Iteration(self):

        # Get iterations
        _type = get_single(self.ui.Type.selected_text(), catch=True)
        _char = get_single(self.ui.Character.selected_data(), catch=True)
        _name = get_single(self.ui.Name.selected_text(), catch=True)
        _desc = get_single(self.ui.Desc.selected_text(), catch=True)
        _iters = sorted(
            set([
                _work.iter for _work in self.o_works
                if _work.type_ == _type and _work.get_root() == _char
                and _work.name == _name and _work.desc == _desc
            ]))

        # Populate list
        self.ui.Iteration.blockSignals(True)
        self.ui.Iteration.clear()
        for _iter in _iters:
            _item = qt.HListWidgetItem('{:02d}'.format(_iter), data=_iter)
            self.ui.Iteration.addItem(_item)
        if _iters:
            self.ui.Iteration.setCurrentRow(0)
        self.ui.Iteration.blockSignals(False)

        self._redraw__Work()
Exemple #4
0
 def _redraw__shots(self, widget):
     for _seq in self.ui.sequences.selected_data():
         for _shot in _seq.find_shots():
             _shot = tk2.obtain_cacheable(_shot)
             _item = qt.HListWidgetItem(_shot.name)
             _item.set_data(_shot)
             widget.addItem(_item)
Exemple #5
0
 def _redraw__Task(self):
     _asset = get_single(self.ui.Asset.selected_text(), catch=True)
     _tasks = sorted(
         set([
             _shaders.task for _shaders in self.shaders_data
             if _shaders.asset == _asset
         ]))
     _items = [qt.HListWidgetItem(_task) for _task in _tasks]
     self.ui.Task.set_items(_items, select='shade')
Exemple #6
0
    def _redraw__Sequence(self):

        self.ui.Sequence.blockSignals(True)
        for _seq in tk2.obtain_sequences():
            _item = qt.HListWidgetItem(_seq.sequence, data=_seq)
            self.ui.Sequence.addItem(_item)
        self.ui.Sequence.setCurrentRow(0)
        self.ui.Sequence.blockSignals(False)

        self._callback__Sequence()
Exemple #7
0
    def _redraw__List(self):

        print 'DRAWING LIST', self.rigs
        self.ui.List.clear()
        for _rig in self.rigs:
            _item = qt.HListWidgetItem(_rig.namespace)
            _item.set_data(_rig)
            print ' - ADDING ITEM', _item, _rig
            self.ui.List.addItem(_item)
            _item.setSelected(True)
Exemple #8
0
    def _redraw__Sequences(self):

        print 'REDRAW Sequences'

        _items = []
        for _seq in tk2.find_sequences():
            _item = qt.HListWidgetItem(_seq.name)
            _item.set_data(_seq)
            _items.append(_item)
        self.ui.Sequences.set_items(_items, verbose=2)
        print 'SEL', self.ui.Sequences.selected_text()
Exemple #9
0
    def _redraw__shots(self, widget, verbose=0):
        _seqs = self.ui.sequences.selected_data()
        _shots = sum([_seq.find_shots(class_=CTTShotRoot) for _seq in _seqs],
                     [])
        _handler = self._get_handler()

        lprint('DREW {:d} SHOTS'.format(len(_shots)), verbose=verbose)
        for _shot in sorted(_shots):
            _item = qt.HListWidgetItem(_shot.shot)
            _item.set_data(_shot)
            _col = 'white' if _shot in _handler.cached_shots else 'grey'
            _item.set_col(_col)
            widget.addItem(_item)
Exemple #10
0
    def _redraw__Shot(self):

        _seq = get_single(self.ui.Sequence.selected_data(), catch=True)
        _filter = self.ui.ShotFilter.text()
        _shots = _seq.find_shots(filter_=_filter) if _seq else []

        self.ui.Shot.blockSignals(True)
        self.ui.Shot.clear()
        for _shot in _shots:
            _item = qt.HListWidgetItem(_shot.shot, data=_shot)
            self.ui.Shot.addItem(_item)
        self.ui.Shot.setCurrentRow(0)
        self.ui.Shot.blockSignals(False)

        self._callback__Shot()
Exemple #11
0
    def _redraw__Shots(self, verbose=0):

        print 'REDRAW SHOTS'

        _seqs = self.ui.Sequences.selected_data()
        _shots = sum([
            _seq.find_shots(class_=BCRoot) for _seq in _seqs], [])
        _handler = self._get_handler()

        lprint('DREW {:d} SHOTS'.format(len(_shots)), verbose=verbose)
        _items = []
        for _shot in sorted(_shots):
            _item = qt.HListWidgetItem(_shot.shot)
            _item.set_data(_shot)
            _col = 'white' if _shot in _handler.cached_shots else 'grey'
            _item.set_col(_col)
            _items.append(_item)
        self.ui.Shots.set_items(_items)
Exemple #12
0
    def _redraw__Task(self):

        _step = get_single(self.ui.Step.selected_data(), catch=True)

        self._work_files = []
        if _step:
            _work_area = _step.get_work_area(dcc=hb_utils.cur_dcc())
            self._work_files = _work_area.find_work()

        # Find mtimes of latest work versions
        _tasks = sorted(set([
            _work.task for _work in self._work_files]))
        _latest_works = [
            [_work for _work in self._work_files if _work.task == _task][-1]
            for _task in _tasks]
        _mtimes = [
            _work.get_mtime() for _work in _latest_works]

        # Clear task edit
        self.ui.TaskEdit.blockSignals(True)
        self.ui.TaskEdit.setText('')
        self.ui.TaskEdit.blockSignals(False)

        # Add to widget
        self.ui.Task.blockSignals(True)
        self.ui.Task.clear()
        for _task, _mtime in safe_zip(_tasks, _mtimes):
            _item = qt.HListWidgetItem(_task)
            if len(set(_mtimes)) == 1:
                _col = qt.HColor('white')
            else:
                _fr = val_map(
                    _mtime, in_min=min(_mtimes), in_max=max(_mtimes))
                _col = qt.HColor('Grey').whiten(_fr)
            _item.set_col(_col)
            self.ui.Task.addItem(_item)
        if _step in _tasks:
            self.ui.Task.select_text([_step])
        else:
            self.ui.Task.setCurrentRow(0)
        self.ui.Task.blockSignals(False)

        self._redraw__Work()
Exemple #13
0
    def _redraw__Asset(self):

        _type = get_single(self.ui.AssetType.selected_text(), catch=True)
        _assets = [_asset for _asset in self._asset_roots
                   if _asset.sg_asset_type == _type]
        _filter = self.ui.AssetFilter.text()
        if _filter:
            _assets = apply_filter(
                _assets, _filter, key=operator.attrgetter('asset'))

        self.ui.Asset.blockSignals(True)
        self.ui.Asset.clear()
        for _asset in _assets:
            _item = qt.HListWidgetItem(_asset.asset, data=_asset)
            self.ui.Asset.addItem(_item)
        self.ui.Asset.setCurrentRow(0)
        self.ui.Asset.blockSignals(False)

        self._callback__Asset()
Exemple #14
0
    def _redraw__Character(self):
        _type = get_single(self.ui.Type.selected_text(), catch=True)

        _works = [_work for _work in self.o_works if _work.type_ == _type]
        _assets = sorted(set([_work.get_root() for _work in _works]))

        # Populate list
        self.ui.Character.blockSignals(True)
        self.ui.Character.clear()
        _items = []
        for _idx, _asset in enumerate(sorted(_assets)):
            _item = qt.HListWidgetItem(text=_asset.asset, data=_asset)
            _items.append(_item)
            self.ui.Character.addItem(_item)
        if _items:
            _items[0].setSelected(True)
        self.ui.Character.blockSignals(False)

        self._redraw__Name()
Exemple #15
0
def create_work_item(work, data=None):
    """Create work list widget item.

    Args:
        work (TTWork): work to build item from
        data (dict): work metadata

    Returns:
        (HListWidgetItem): list widget item for this work file
    """
    _icon = get_work_icon(work)
    _text = _get_work_text(work, data=data)
    _col = _get_work_col(work)
    _item = qt.HListWidgetItem(_text)
    if _col:
        _item.set_col(_col)
    _item.set_data(work)
    _item.set_icon(_icon)

    return _item
Exemple #16
0
 def _redraw__Traceback(self):
     self.ui.Traceback.clear()
     for _line in reversed(self.traceback.lines):
         _item = qt.HListWidgetItem(_line.text, data=_line)
         self.ui.Traceback.addItem(_item)
     self.ui.Traceback.setCurrentRow(0)
Exemple #17
0
 def _redraw__Asset(self):
     _assets = sorted(
         set([_shaders.asset for _shaders in self.shaders_data]))
     _items = [qt.HListWidgetItem(_asset) for _asset in _assets]
     self.ui.Asset.set_items(_items)
Exemple #18
0
 def _redraw__sequences(self, widget):
     for _seq in tk2.find_sequences():
         _item = qt.HListWidgetItem(_seq.name)
         _item.set_data(_seq)
         widget.addItem(_item)
Exemple #19
0
 def _redraw__list(self, widget):
     for _rig in self.rigs:
         _item = qt.HListWidgetItem(_rig.namespace)
         _item.set_data(_rig)
         widget.addItem(_item)