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:
        current_pipeline = pipelines.get(pipeline)
        if (not current_pipeline):
            current_pipeline = list(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:
        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)
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:
        current_pipeline = pipelines.get(pipeline)
        if (not current_pipeline):
            current_pipeline = list(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:
        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)