def checkin_icon_file(self, search_key):
        stype = self.tactic_widget.get_stype()

        checkin_widget = env_inst.get_check_tree(
            tab_code='checkin_out', wdg_code=stype.info.get('code'))

        files_list = self.get_upload_list()

        if files_list:
            match_template = gf.MatchTemplate(['$FILENAME.$EXT'])
            files_objects_dict = match_template.get_files_objects(files_list)
            commit_queue_ui = None
            for file_object in files_objects_dict.get('file'):
                commit_queue_ui = checkin_widget.checkin_file_objects(
                    search_key,
                    'icon',
                    '',
                    files_objects=[file_object],
                    checkin_type='file',
                    keep_file_name=False,
                    commit_silently=True,
                    update_versionless=True)

            if commit_queue_ui:
                commit_queue_ui.commit_queue()

        return files_list
    def upload_attachments(self):
        stype = self.sobject.get_stype()
        search_key = self.sobject.info['__search_key__']

        checkin_widget = env_inst.get_check_tree(
            tab_code='checkin_out', wdg_code=stype.info.get('code'))

        files_objects = self.get_attachmnents_files_objects()

        if files_objects:

            commit_queue_ui = None
            for file_object in files_objects.get('file'):

                context = 'attachment/{0}/{1}'.format(
                    self.context, file_object.get_file_name(True))

                commit_queue_ui = checkin_widget.checkin_file_objects(
                    search_key,
                    context,
                    '',
                    files_objects=[file_object],
                    checkin_type='file',
                    keep_file_name=False,
                    commit_silently=True,
                    update_versionless=True)

            if commit_queue_ui:
                commit_queue_ui.finished.connect(self.add_note)
                commit_queue_ui.commit_queue()

        else:
            self.add_note()
            self.query_notes()
    def refresh_search_widget(self):

        checkin_out = env_inst.get_check_tree(
            self.parent_stype.get_project().get_code(), 'checkin_out',
            self.parent_stype.get_code())

        if checkin_out:
            checkin_out.refresh_current_results()
Exemple #4
0
    def get_checkin_out_tab(self):

        stype = self.parent_stype
        if not stype:
            stype = self.stype

        return env_inst.get_check_tree(
            project_code=stype.project.info.get('code'),
            tab_code='checkin_out',
            wdg_code=stype.info.get('code'))
    def set_dock_title(self, title_string):

        related_tasks_dock = env_inst.get_check_tree(
            self.project.get_code(), 'checkin_out_instanced_widgets',
            'tasks_dock')

        dock_widget = related_tasks_dock.parent()
        if dock_widget:
            if isinstance(dock_widget, QtGui.QDockWidget):
                dock_widget.setWindowTitle(title_string)
Exemple #6
0
    def bring_dock_widget_up(self, sobject):

        related_notes_dock = env_inst.get_check_tree(
            self.project.get_code(), 'checkin_out_instanced_widgets', 'notes_dock')

        dock_widget = related_notes_dock.parent()
        if dock_widget:
            if type(dock_widget) == QtGui.QDockWidget:
                dock_widget.setHidden(False)
                dock_widget.raise_()
    def prnt(self, event, watch):

        self.show()

        self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized
                            | QtCore.Qt.WindowActive)
        QtGui.QDialog.activateWindow(self)
        self.show()
        self.hide()

        search_key = watch.watch_name

        commit_path = gf.extract_dirname(event.src_path)

        if watch.path == commit_path:
            context = 'publish'
        else:
            context = gf.form_path(commit_path, 'linux').split('/')[-1]

        description = 'From watch folder'

        skey_dict = tc.split_search_key(search_key)

        checkin_widget = env_inst.get_check_tree(
            project_code=skey_dict['project_code'],
            tab_code='checkin_out',
            wdg_code=skey_dict['pipeline_code'],
        )

        checkin_widget.do_creating_ui()

        match_template = gf.MatchTemplate(['$FILENAME.$EXT'])
        files_objects_dict = match_template.get_files_objects([event.src_path])

        stypes = self.project.get_stypes()
        current_stype = stypes.get(skey_dict['pipeline_code'])
        pipelines = current_stype.get_pipeline()
        print(skey_dict['pipeline_code'])
        current_pipeline = pipelines.get(skey_dict['pipeline_code'])
        print(current_pipeline)
        current_process = current_pipeline.get_process(context)
        print(current_pipeline.process)
        print(current_process)

        checkin_mode = None
        if current_process:
            checkin_mode = current_process.get('checkin_mode')

        checkin_widget.checkin_file_objects(
            search_key=search_key,
            context=context,
            description=description,
            files_objects=files_objects_dict.get('file'),
            checkin_type=checkin_mode,
            keep_file_name=False)
    def bring_dock_widget_up(self):

        related_tasks_dock = env_inst.get_check_tree(
            self.project.get_code(), 'checkin_out_instanced_widgets',
            'tasks_dock')

        dock_widget = related_tasks_dock.parent()
        if dock_widget:
            if isinstance(dock_widget, QtGui.QDockWidget):
                dock_widget.setHidden(False)
                dock_widget.raise_()
Exemple #9
0
    def set_dock_title(self, title_string):

        checkin_out_widget = env_inst.get_check_tree(self.project.get_code(),
                                                     'checkin_out',
                                                     self.stype.get_code())

        columns_viewer_widget = checkin_out_widget.get_columns_viewer_widget()

        dock_widget = columns_viewer_widget.parent()
        if dock_widget:
            if isinstance(dock_widget, QtGui.QDockWidget):
                dock_widget.setWindowTitle(title_string)
Exemple #10
0
def save_as(project_code, tab_code, wdg_code):

    current_type = cmds.optionVar(q='defaultFileSaveType')
    current_ext = cmds.translator(str(current_type), q=True, filter=True)
    current_ext = current_ext.split(';')[0]

    current_checkin_widget = env_inst.get_check_tree(project_code, tab_code,
                                                     wdg_code)

    current_checkin_widget.save_file(
        selected_objects=[False, {
            current_type: current_ext[2:]
        }])
    def refresh_result_after_commit(self):
        updated_list = []

        for commit_item in self.queue_list:
            item_widget = commit_item.get_args_dict()['item_widget']
            pipeline_code = item_widget.search_widget.stype.get_code()

            search_key = tc.split_search_key(commit_item.get_args_dict()['search_key'])

            checkin_ui = env_inst.get_check_tree(search_key['project_code'], 'checkin_out', pipeline_code)

            if checkin_ui not in updated_list:
                checkin_ui.refresh_results()
                updated_list.append(checkin_ui)
    def handle_watch_created_event(self, event, watch):
        dl.log(u'File dropped to watch folder {}'.format(event.src_path), group_id='watch_folder')

        self.show()

        self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
        QtGui.QDialog.activateWindow(self)
        self.show()
        self.hide()

        search_key = watch.watch_name
        pipeline = watch.pipeline

        commit_path = gf.extract_dirname(event.src_path)

        if watch.path == commit_path:
            context = 'publish'
        else:
            context = gf.form_path(commit_path, 'linux').split('/')[-1]

        description = 'From watch folder'

        skey_dict = tc.split_search_key(search_key)

        checkin_widget = env_inst.get_check_tree(
            project_code=skey_dict['project_code'],
            tab_code='checkin_out',
            wdg_code=skey_dict['pipeline_code'],

        )

        checkin_widget.do_creating_ui()

        match_template = gf.MatchTemplate(['$FILENAME.$EXT'])
        files_objects_dict = match_template.get_files_objects([event.src_path])

        stypes = self.project.get_stypes()
        current_stype = stypes.get(skey_dict['pipeline_code'])
        pipelines = current_stype.get_pipeline()

        checkin_mode = None
        if pipelines:

            # here we do pipelines routine
            current_pipeline = pipelines.get(pipeline)
            if not current_pipeline:
                # looks like we don't have pipeline with Search Type name, so we take first of all
                # Also this is totally wrong, cause we should know exactly the pipeline and its processes, so need to write proper pipeline_code when creating watch folder
                current_pipeline = pipelines.values()[0]

            current_process = current_pipeline.get_pipeline_process(context)

            if current_process:
                checkin_mode = current_process.get('checkin_mode')
            else:
                context = 'publish'

            checkin_widget.checkin_file_objects(
                search_key=search_key,
                context=context,
                description=description,
                files_objects=files_objects_dict.get('file'),
                checkin_type=checkin_mode,
                keep_file_name=False
            )
        else:
            # here we go with publish, without pipeline
            checkin_widget.checkin_file_objects(
                search_key=search_key,
                context='publish',
                description=description,
                files_objects=files_objects_dict.get('file'),
                checkin_type=checkin_mode,
                keep_file_name=False
            )