Ejemplo n.º 1
0
    def __init__(self,
                 parent=None,
                 path_object=None,
                 search_box=None,
                 title='Projects'):
        QtWidgets.QWidget.__init__(self, parent)
        self.path_object = path_object
        self.project_management = CONFIG['account_info']['project_management']
        self.user_email = CONFIG['project_management'][
            self.project_management]['users'][current_user()]
        self.root = CONFIG['paths']['root']  # Company Specific
        self.user_root = CONFIG['cg_lumberjack_dir']
        self.left_column_visibility = True
        self.title = title
        # Create the Left Panel
        self.panel = QtWidgets.QVBoxLayout(self)
        if title == 'Projects':
            pixmap = QtGui.QPixmap(icon_path('project24px.png'))
        elif title == 'Companies':
            pixmap = QtGui.QPixmap(icon_path('company24px.png'))
        self.project_filter = ProjectWidget(title=title,
                                            pixmap=pixmap,
                                            search_box=search_box,
                                            path_object=self.path_object)

        self.panel.addWidget(self.project_filter)
        if title == 'Projects':
            self.load_projects()
        elif title == 'Companies':
            self.load_companies()

        self.project_filter.data_table.doubleClicked.connect(
            self.on_project_changed)
        self.project_filter.add_button.clicked.connect(self.on_create_project)
Ejemplo n.º 2
0
def user_init():
    """
    Initializes needed User information
    :return:
    """
    from cgl.core.config import app_config
    from cgl.core.utils.general import current_user
    from cgl.ui.widgets.dialog import LoginDialog
    current = current_user().lower()
    print current
    CONFIG = app_config()
    proj_man = CONFIG['account_info']['project_management']
    print proj_man
    users = CONFIG['project_management'][proj_man]['users']
    print users
    if users:
        print 1
        if current in users.keys():
            print 'Found user: %s in company globals' % current
            return proj_man, users[current]
        else:
            dialog = LoginDialog()
            dialog.exec_()
            if dialog.button == 'Ok':
                return proj_man, dialog.user_info
    else:
        print 'ERROR: %s not found in company globals file' % current
        dialog = LoginDialog()
        dialog.exec_()
        if dialog.button == 'Ok':
            return proj_man, dialog.user_info
        return False
Ejemplo n.º 3
0
    def __init__(self,
                 parent=None,
                 path_object=None,
                 user_email='',
                 machine_user=None,
                 show_import=False):
        QtWidgets.QWidget.__init__(self, parent)
        # self.setWidgetResizable(True)
        self.work_files = []
        self.in_current_folder = False
        self.render_files_widget = None
        self.high_files = []
        self.render_files = []
        self.version_obj = None
        self.task = path_object.task
        self.task_widgets_dict = {}
        self.show_import = show_import
        self.path_object = path_object
        self.project_management = CONFIG['account_info']['project_management']
        self.schema = CONFIG['project_management'][
            self.project_management]['api']['default_schema']
        schema = CONFIG['project_management'][
            self.project_management]['tasks'][self.schema]
        self.user_info = CONFIG['project_management'][
            self.project_management]['users'][current_user()]
        self.proj_man_tasks = schema['long_to_short'][self.path_object.scope]
        self.proj_man_tasks_short_to_long = schema['short_to_long'][
            self.path_object.scope]

        self.current_location = path_object.data
        self.panel = QtWidgets.QVBoxLayout(self)
        self.tasks = QtWidgets.QHBoxLayout()
        self.in_file_tree = None
        self.user_changed_versions = False
        self.user_email = user_email
        if machine_user:
            self.user = machine_user
        else:
            self.user = current_user()
        self.project_management = CONFIG['account_info']['project_management']
        self.on_task_selected(self.path_object)
        self.panel.addLayout(self.tasks)
        self.panel.addStretch(1)

        self.force_clear = False
        self.auto_publish_tasks = ['plate', 'element']
Ejemplo n.º 4
0
def pull_task_info(path_object):
    from cgl.core.utils.general import current_user
    if PROJ_MANAGEMENT == 'ftrack':
        from plugins.project_management.ftrack.main import find_user_assignments
        login = CONFIG['project_management']['ftrack']['users'][current_user()]
        project_tasks = find_user_assignments(path_object, login, force=True)
        task_info = project_tasks[path_object.task_name]
        return task_info
Ejemplo n.º 5
0
 def show_my_tasks(self):
     self.path_object = cglpath.PathObject(
         self.path_widget.path_line_edit.text())
     self.path_object.set_attr(user=current_user(),
                               resolution='',
                               filename='',
                               ext='')
     self.path_object.set_attr(scope='shots', seq='*', shot=None, task=None)
     self.path_object.data['my_tasks'] = True
     self.path_widget.update_path(path_object=self.path_object)
     self.update_location(self.path_object)
Ejemplo n.º 6
0
 def on_assign_button_clicked(self, data):
     print data
     task = self.sender().task
     users_dict = CONFIG['project_management'][
         self.project_management]['users']
     all_users = []
     for each in users_dict.keys():
         all_users.append(each.lower())
     dialog = InputDialog(title="%s Task Ownership" % task,
                          combo_box_items=users_dict.keys(),
                          message='Who are you assigning this Task?',
                          buttons=['Cancel', 'Start'])
     index = dialog.combo_box.findText(current_user().lower())
     if index != -1:
         dialog.combo_box.setCurrentIndex(index)
     dialog.exec_()
     if dialog.button == 'Start':
         selected_user = dialog.combo_box.currentText(
         )  # this denotes the OS login name of the user
         print selected_user
         user_info = CONFIG['project_management'][
             self.project_management]['users'][selected_user]
         self.path_object.set_attr(task=task)
         self.path_object.set_attr(user=selected_user)
         self.path_object.set_attr(version='000.000')
         self.path_object.set_attr(resolution='high')
         self.path_object.set_attr(shot=data.shot)
         self.path_object.set_attr(seq=data.seq)
         self.path_object.set_attr(filename=None)
         self.path_object.set_attr(ext=None)
         self.path_object.set_attr(filename_base=None)
         CreateProductionData(path_object=self.path_object,
                              project_management=self.project_management,
                              user_login=user_info['login'],
                              force_pm_creation=True)
     self.update_task_location(path_object=self.path_object)
Ejemplo n.º 7
0
    def on_task_selected(self, data):
        try:
            if isinstance(data, PathObject):
                current = data.copy()
            elif isinstance(data, dict):
                'its a dict, this sucks'
                current = PathObject(data)
        except IndexError:
            print 'Nothing Selected'
            return
        if data:
            self.clear_layout(self.panel)
            # reset the GUI
            if not current.task:
                current.set_attr(task='*')
            current.set_attr(root=self.path_object.root)
            # current.set_attr(user_email=self.user_email)
            self.panel.seq = current.seq
            self.panel.shot = current.shot
            self.update_task_location(path_object=current)
            self.panel.tasks = []
            try:
                if 'elem' in self.task:
                    title = self.task
                else:
                    title = self.proj_man_tasks_short_to_long[self.task]
            except KeyError:
                return
            task_widget = TaskWidget(parent=self,
                                     title=title,
                                     path_object=current,
                                     show_import=self.show_import)
            task_widget.task = self.task
            self.render_files_widget = task_widget.files_area.export_files_table
            task_widget.files_area.export_files_table.hide()
            self.task_widgets_dict[self.task] = task_widget

            # find the version information for the task:
            user = self.populate_users_combo(task_widget, current, self.task)
            self.current_location['user'] = user
            version = self.populate_versions_combo(task_widget, current,
                                                   self.task)
            self.current_location['version'] = version
            resolution = self.populate_resolutions_combo(
                task_widget, current, self.task)
            self.current_location['resolution'] = resolution
            self.update_task_location(self.current_location)
            self.panel.addWidget(task_widget)
            self.panel.tasks.append(self.task)
            self.version_obj = current.copy(task=self.task,
                                            user=user,
                                            version=version,
                                            resolution=resolution,
                                            context='source',
                                            filename='*')
            task_widget.files_area.work_files_table.task = self.version_obj.task
            task_widget.files_area.work_files_table.user = self.version_obj.user
            task_widget.files_area.work_files_table.version = self.version_obj.version
            task_widget.files_area.work_files_table.resolution = self.version_obj.resolution
            try:
                self.work_files = self.version_obj.glob_project_element(
                    'filename', full_path=True)
                self.high_files = self.version_obj.copy(
                    resolution='high').glob_project_element('filename',
                                                            full_path=True)
            except ValueError:
                self.work_files = []
                self.high_files = []
            # check to see if there are work files for the 'high' version
            self.render_files = []
            if user != 'publish':
                my_files_label = 'My Work Files'
                if not self.work_files:
                    my_files_label = 'Drag/Drop Work Files'
                    task_widget.files_area.work_files_table.hide()
            else:
                my_files_label = 'Published Work Files'
            logging.debug('Work Files: %s' % self.work_files)
            task_widget.setup(
                task_widget.files_area.work_files_table,
                FileTableModel(
                    self.prep_list_for_table(self.work_files, basename=True),
                    [my_files_label]))
            self.load_render_files(task_widget)
            task_widget.create_empty_version.connect(
                self.new_empty_version_clicked)
            task_widget.files_area.review_button_clicked.connect(
                self.on_review_clicked)
            task_widget.files_area.publish_button_clicked.connect(
                self.on_publish_clicked)
            task_widget.copy_latest_version.connect(
                self.new_version_from_latest)
            task_widget.copy_selected_version.connect(
                self.version_up_selected_clicked)
            task_widget.files_area.work_files_table.selected.connect(
                self.on_source_selected)
            task_widget.files_area.export_files_table.selected.connect(
                self.on_render_selected)
            task_widget.files_area.export_files_table.double_clicked.connect(
                self.on_render_double_clicked)
            task_widget.files_area.export_files_table.show_in_folder.connect(
                self.show_selected_in_folder)
            task_widget.files_area.work_files_table.doubleClicked.connect(
                self.on_open_clicked)
            task_widget.files_area.open_button.clicked.connect(
                self.on_open_clicked)
            task_widget.files_area.import_button.clicked.connect(
                self.on_import_clicked)
            task_widget.versions.currentIndexChanged.connect(
                self.on_task_info_changed)
            task_widget.users.currentIndexChanged.connect(
                self.on_task_info_changed)
            task_widget.resolutions.currentIndexChanged.connect(
                self.on_task_info_changed)
            task_widget.start_task_clicked.connect(
                self.on_assign_button_clicked)
            task_widget.files_area.work_files_table.dropped.connect(
                self.on_file_dragged_to_source)
            task_widget.files_area.export_files_table.dropped.connect(
                self.on_file_dragged_to_render)
            task_widget.files_area.work_files_table.show_in_folder.connect(
                self.show_selected_in_folder)
            task_widget.files_area.work_files_table.copy_folder_path.connect(
                self.copy_folder_path)
            task_widget.files_area.work_files_table.copy_file_path.connect(
                self.copy_file_path)
            task_widget.files_area.work_files_table.import_version_from.connect(
                self.import_versions_from)
            task_widget.empty_state.files_added.connect(
                self.on_file_dragged_to_source)
            if not user:
                task_widget.users_label.hide()
                task_widget.users.hide()
                task_widget.files_area.hide()
                task_widget.versions_label.hide()
                task_widget.versions.hide()
                task_widget.resolutions_label.hide()
                task_widget.resolutions.hide()
                task_widget.empty_state.hide()
                task_widget.status_button.hide()
            else:
                if task_widget.users.currentText() == current_user():
                    task_widget.refresh_task_info()
                else:
                    task_widget.status_button.hide()
Ejemplo n.º 8
0
        dialog.setMinimumWidth(1200)
        dialog.setMinimumHeight(500)
        dialog.exec_()

    def on_menu_designer_clicked(self):
        self.on_designer_clicked()

    def closeEvent(self, event):
        # set the current path so that it works on the load better.
        user_config = UserConfig(
            current_path=self.centralWidget().path_widget.text)
        user_config.update_all()

    # check the config file to see if it has a default company and a default location


def sleeper():
    time.sleep(5)


if __name__ == "__main__":
    import sys
    project_management = CONFIG['account_info']['project_management']
    users = CONFIG['project_management'][project_management]['users']
    app = QtWidgets.QApplication(sys.argv)
    main_window = CGLumberjack(user_info=users[current_user()])
    main_window.setWindowTitle('CG Lumberjack: Nuke')
    main_window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
    main_window.show()
    app.exec_()
Ejemplo n.º 9
0
 def load_tasks(self):
     from cgl.core.config import UserConfig
     # TODO - figure out how to add the progress bar to this.
     self.assets.add_button.setEnabled(False)
     self.assets.data_table.clearSpans()
     data = []
     proj_man = CONFIG['account_info']['project_management']
     login = CONFIG['project_management'][proj_man]['users'][
         current_user()]['login']
     if proj_man == 'ftrack':
         # ideally we load from a .csv file and run this in the background only to update the .csv file.
         from plugins.project_management.ftrack.main import find_user_assignments
         process_method(self.parent().progress_bar,
                        find_user_assignments,
                        args=(self.path_object, login),
                        text='Finding Your Tasks')
         try:
             company_json = UserConfig().d['my_tasks'][
                 self.path_object.company]
         except KeyError:
             print 'Couldnt find company %s in company_json tasks file.' % self.path_object.company
             self.parent().progress_bar.hide()
             return
         if self.path_object.project in company_json:
             project_tasks = company_json[self.path_object.project]
             if project_tasks:
                 for task in project_tasks:
                     data.append([
                         project_tasks[task]['seq'],
                         project_tasks[task]['shot_name'],
                         project_tasks[task]['filepath'],
                         project_tasks[task]['due_date'],
                         project_tasks[task]['status'],
                         project_tasks[task]['task_type']
                     ])
                 if data:
                     self.assets.data_table.show()
                     self.assets.search_box.show()
                     self.assets.message.setText('')
                     self.assets.setup(
                         ListItemModel(data, [
                             'Category', 'Name', 'Path', 'Due Date',
                             'Status', 'Task'
                         ]))
                     self.assets.data_table.hideColumn(0)
                     self.assets.data_table.hideColumn(2)
                     self.assets.data_table.hideColumn(3)
                 else:
                     self.assets.data_table.hide()
                     self.assets.message.setText('No Tasks for %s Found!' %
                                                 login)
                     self.assets.message.show()
                 self.parent().progress_bar.hide()
                 return True
             else:
                 print 'No Tasks Assigned for %s' % self.path_object.project
                 self.parent().progress_bar.hide()
                 return False
         else:
             self.parent().progress_bar.hide()
             return False