def __init__(self, parent=None, path_object=None): QtWidgets.QWidget.__init__(self, parent) if path_object: self.path_object = path_object.copy(seq=None, shot=None, ingest_source=None, resolution='', version='', user=None, scope=None) else: return self.panel = QtWidgets.QVBoxLayout(self) for each in ['assets', 'shots']: if each == 'assets': image_name = 'flower_80px.png' elif each == 'shots': image_name = 'shots96px.png' elif each == 'my tasks': image_name = 'star96px.png' else: image_name = 'ingest96px.png' button = LJButton(str(each)) button.setIcon( QtGui.QIcon( QtGui.QPixmap(os.path.join(icon_path(), image_name)))) button.setIconSize(QtCore.QSize(50, 50)) button.setProperty('class', 'ultra_button') self.panel.addWidget(button) button.clicked.connect(self.on_button_clicked) self.panel.addStretch(1)
def load_buttons(self): for i in range(len(self.menu)): for button in self.menu: if button != 'order': if i == self.menu[button]['order']: button_widget = CGLMenuButton(parent=self.buttons_tab_widget, preflight_name=self.menu_name, preflight_step_name=button, attrs=self.menu[button], preflight_path=self.menu_path, menu_type=self.menu_type) if 'icon' in self.menu[button].keys(): if self.menu[button]['icon']: icon = QtGui.QIcon(self.menu[button]['icon']) self.buttons_tab_widget.addTab(button_widget, icon, self.menu[button]['name']) else: self.buttons_tab_widget.addTab(button_widget, button) else: self.buttons_tab_widget.addTab(button_widget, button)
def on_add_menu_button(self): if self.menu_type == 'preflights': title_ = 'Add Preflight Step' message = 'Enter a Name for your Preflight Step' elif self.menu_type == 'menus': title_ = 'Add Menu' message = 'Enter a Name for your Menu Button' elif self.menu_type == 'shelves': title_ = 'Add Shelf' message = 'Enter a Name for your shelf button' elif self.menu_type == 'context-menus': title_ = 'Add Context Menu Item' message = 'Enter a name for your Context Menu Item' dialog = InputDialog(title=title_, message=message, line_edit=True, regex='^([A-Z][a-z]+)+$', name_example='class name must be CamelCase - ExamplePreflightName') dialog.exec_() if dialog.button == 'Ok': preflight_name = dialog.line_edit.text() command = self.get_command_text(button_name=preflight_name, menu_type=self.menu_type) module = self.default_preflight_text(preflight_name) if self.menu_type == 'preflights': attrs = {'label': preflight_name, 'name': preflight_name, 'required': 'True', 'module': module} elif self.menu_type == 'menus' or self.menu_type == 'context-menus': attrs = {'label': preflight_name, 'name': preflight_name, 'module': command} elif self.menu_type == 'shelves': attrs = {'label': preflight_name, 'module': command, 'name': preflight_name, 'icon': ''} self.new_button_widget = CGLMenuButton(parent=self.buttons_tab_widget, preflight_name=self.menu_name, preflight_step_name=dialog.line_edit.text(), attrs=attrs, preflight_path=self.menu_path, menu_type=self.menu_type) self.new_button_widget.save_all_signal.connect(self.on_save_clicked) if 'icon' in attrs.keys(): icon = QtGui.QIcon(attrs['icon']) index = self.buttons_tab_widget.addTab(self.new_button_widget, icon, preflight_name) else: index = self.buttons_tab_widget.addTab(self.new_button_widget, preflight_name) self.buttons_tab_widget.setCurrentIndex(index)
def add_path_line(self, layout_, key, paths_dict, row, hide_on_find): """ :param layout_: :param key: :param paths_dict: :param row: :param hide_on_find: :return: """ label = QtWidgets.QLabel(key) line_edit = QtWidgets.QLineEdit() line_edit.setText(paths_dict[key]) if key == 'root': line_edit.editingFinished.connect(self.on_root_set) folder_button = QtWidgets.QToolButton() if key == 'cgl_tools': self.cgl_tools_folder = folder_button folder_button.setIcon(QtGui.QIcon(self.icon_path('folder24px.png'))) folder_button.line_edit = line_edit folder_button.label = label message = QtWidgets.QLabel('Path Not Found, Please Specify %s' % key) # message.setPalette(self.red_palette) folder_button.message = message self.widget_dict[key] = { 'label': label, 'line_edit': line_edit, 'message': message } layout_.addWidget(label, row, 0) layout_.addWidget(line_edit, row, 1) layout_.addWidget(folder_button, row, 2) layout_.addWidget(message, row + 1, 1) folder_button.clicked.connect(self.on_path_chosen) self.check_path(key, label, line_edit, message, folder_button, hide_on_find=hide_on_find) line_edit.textChanged.connect(lambda: self.on_line_edit_changed(key)) return row + 2
def on_icon_button_clicked(self): default_folder = os.path.join(get_cgl_tools(), self.software, self.menu_type, self.preflight_name) file_paths = QtWidgets.QFileDialog.getOpenFileName(self, 'Choose a File to Attach', default_folder, "*") from_path = file_paths[0].replace('\\', '/') _, file_ = os.path.split(from_path) to_path = os.path.join(default_folder, file_).replace('\\', '/') if from_path != to_path: dirname = os.path.dirname(to_path) if not os.path.exists(dirname): os.makedirs(dirname) cgl_copy(from_path, to_path) self.icon_path_line_edit.setText(to_path) icon = QtGui.QIcon(to_path) tab_ = self.parent().parent() index_ = tab_.currentIndex() # print index_ tab_.setTabIcon(index_, icon) # # display the icon? self.on_save_clicked()
def load_import_events(self, new=False): latest = '-001.000' self.ingest_widget.list.clear() events = glob.glob( '%s/%s' % (self.path_object.split_after('ingest_source'), '*')) if events: self.ingest_widget.empty_state.hide() self.ingest_widget.show() for e in events: self.ingest_widget.list.addItem(os.path.split(e)[-1]) latest = os.path.split(e)[-1] else: self.ingest_widget.empty_state.show() self.ingest_widget.empty_state.setText("No Ingests") pixmap = QtGui.QPixmap(icon_path('axeWarning24px.png')) icon = QtGui.QIcon(pixmap) self.ingest_widget.set_icon(icon) self.path_object.set_attr(version=latest) if not new: self.path_object = self.path_object.next_major_version() self.empty_state.setText('Drag Files Here to %s' % self.path_object.version)
def __init__(self, parent=None, path_object=None): QtWidgets.QWidget.__init__(self, parent) if path_object: self.path_object = path_object else: print 'No Path Object found, exiting' return self.project_management = CONFIG['account_info']['project_management'] self.schema = CONFIG['project_management'][ self.project_management]['api']['default_schema'] self.schema_dict = CONFIG['project_management'][ self.project_management]['tasks'][self.schema] self.path_object_next = None self.panel = QtWidgets.QVBoxLayout(self) h_layout = QtWidgets.QHBoxLayout() self.title = 'Import to %s' % path_object.project self.task = None self.version = '000.000' self.latest_version = '000.000' self.user = None self.resolution = None self.root = None self.company = None self.project = None self.data_frame = None self.width_hint = 1300 self.height_hint = 1200 self.current_selection = None self.path_object.set_attr(scope='IO') self.path_object.set_attr(ingest_source='*') self.data_frame = None self.pandas_path = '' self.io_statuses = ['Imported', 'Tagged', 'Published'] self.file_tree = LJTreeWidget(self) #self.width_hint = self.file_tree.width_hint pixmap = QtGui.QPixmap(icon_path('back24px.png')) import_empty_icon = QtGui.QIcon(pixmap) self.source_widget = LJListWidget('Sources', pixmap=None) self.ingest_widget = LJListWidget('Ingests', pixmap=None, empty_state_text='Select Source', empty_state_icon=import_empty_icon) # self.import_events.hide()f self.tags_title = QtWidgets.QLineEdit( "<b>Select File(s) or Folder(s) to tag</b>") self.tags_title.setReadOnly(True) self.tags_title.setProperty('class', 'feedback') self.tags_button = QtWidgets.QPushButton('View Publish') self.tags_button.setProperty('class', 'basic') self.tags_button.setMaximumWidth(180) self.tags_title_row = QtWidgets.QHBoxLayout() self.tags_title_row.addWidget(self.tags_title) self.tags_title_row.addWidget(self.tags_button) self.tags_button.hide() self.scope_label = QtWidgets.QLabel('Scope') self.scope_combo = AdvComboBox() self.scope_combo.addItems(['', 'assets', 'shots']) self.seq_row = QtWidgets.QHBoxLayout() self.seq_row.addWidget(self.scope_label) self.seq_row.addWidget(self.scope_combo) self.feedback_area = QtWidgets.QLabel('') self.seq_label = QtWidgets.QLabel('Seq ') self.seq_combo = AdvComboBox() self.seq_row.addWidget(self.seq_label) self.seq_row.addWidget(self.seq_combo) self.shot_label = QtWidgets.QLabel('Shot') self.shot_combo = AdvComboBox() self.seq_row.addWidget(self.shot_label) self.seq_row.addWidget(self.shot_combo) self.task_label = QtWidgets.QLabel('Task') self.task_combo = AdvComboBox() self.task_combo.setEditable(False) self.seq_row.addWidget(self.task_label) self.seq_row.addWidget(self.task_combo) self.tags_label = QtWidgets.QLabel("Tags") self.tags_label.setWordWrap(True) self.tags_label.setMaximumWidth(100) self.tags_line_edit = QtWidgets.QLineEdit() self.tags_row = QtWidgets.QHBoxLayout() self.tags_row.addWidget(self.tags_label) self.tags_row.addWidget(self.tags_line_edit) # create buttons row self.buttons_row = QtWidgets.QHBoxLayout() self.publish_button = QtWidgets.QPushButton('Publish Selected') self.view_in_lumbermill = QtWidgets.QPushButton('View in Lumbermill') self.view_in_lumbermill.setMinimumWidth(220) self.refresh_button = QtWidgets.QPushButton('Refresh') self.refresh_button.hide() self.publish_button.setProperty('class', 'basic') self.view_in_lumbermill.setProperty('class', 'basic') self.refresh_button.setProperty('class', 'basic') self.buttons_row.addStretch(1) self.buttons_row.addWidget(self.refresh_button) self.buttons_row.addWidget(self.view_in_lumbermill) self.buttons_row.addWidget(self.publish_button) self.empty_state = EmptyStateWidgetIO(path_object=self.path_object) self.empty_state.setText( 'Select a Source:\n Click + to Create a new one') self.progress_bar = ProgressGif() self.progress_bar.hide() self.view_in_lumbermill.hide() h_layout.addWidget(self.source_widget) h_layout.addWidget(self.ingest_widget) self.panel.addLayout(h_layout) self.panel.addWidget(self.file_tree) self.panel.addWidget(self.empty_state) self.panel.addLayout(self.tags_title_row) self.panel.addWidget(self.progress_bar) self.panel.addLayout(self.seq_row) self.panel.addLayout(self.tags_row) self.panel.addLayout(self.buttons_row) self.panel.addWidget(self.feedback_area) self.panel.addStretch(1) self.load_companies() self.ingest_widget.empty_state.show() self.ingest_widget.list.hide() self.hide_tags() self.file_tree.hide() self.view_in_lumbermill.clicked.connect( self.on_view_in_lumbermill_clicked) self.refresh_button.clicked.connect(self.on_ingest_selected) self.scope_combo.currentIndexChanged.connect(self.on_scope_changed) self.seq_combo.currentIndexChanged.connect(self.on_seq_changed) self.file_tree.selected.connect(self.on_file_selected) self.seq_combo.currentIndexChanged.connect(self.edit_data_frame) self.shot_combo.currentIndexChanged.connect(self.edit_data_frame) self.task_combo.currentIndexChanged.connect(self.edit_data_frame) self.tags_line_edit.textChanged.connect(self.edit_tags) self.source_widget.add_button.clicked.connect( self.on_source_add_clicked) self.source_widget.list.clicked.connect(self.on_source_selected) self.ingest_widget.list.clicked.connect(self.on_ingest_selected) self.ingest_widget.add_button.clicked.connect(self.on_add_ingest_event) self.publish_button.clicked.connect(self.publish_selected_asset) self.empty_state.files_added.connect(self.new_files_dragged) logging.info('Testing the popup') self.on_scope_changed()
def __init__(self, parent=None, preflight_name='', preflight_step_name='', attrs=None, preflight_path='', menu_type='preflights'): # TODO - we need to choose better variable names, this is obviously "preflight" specific. QtWidgets.QWidget.__init__(self, parent) try: dialog = self.parent().parent().parent() print dialog self.software = dialog.software_combo.currentText() except AttributeError: # TODO - look into this a bit deeper, this is a fairly generic catch right now. dialog = self.parent().parent().parent().parent().parent() self.software = dialog.software_combo.currentText() self.menu_type = menu_type self.attrs = attrs self.name = preflight_step_name self.preflight_name = preflight_name self.preflight_path = preflight_path self.do_save = True # Create the Layouts layout = QtWidgets.QVBoxLayout(self) grid_layout = QtWidgets.QGridLayout() tool_row = QtWidgets.QHBoxLayout() # labels module_label = QtWidgets.QLabel('module') required_label = QtWidgets.QLabel('required') label_label = QtWidgets.QLabel('label') icon_button = QtWidgets.QToolButton() icon_button.setIcon(QtGui.QIcon(os.path.join(icon_path(), 'folder24px.png'))) self.icon_label = QtWidgets.QLabel('icon') name_label = QtWidgets.QLabel('name') # line edits self.command_line_edit = QtWidgets.QLineEdit() self.command_line_edit.setEnabled(False) self.required_line_edit = QtWidgets.QLineEdit() self.required_line_edit.setText('True') self.icon_path_line_edit = QtWidgets.QLineEdit() # self.required_line_edit.setEnabled(False) self.label_line_edit = QtWidgets.QLineEdit() self.name_line_edit = QtWidgets.QLineEdit() self.attrs_dict = {'module': self.command_line_edit, 'required': self.required_line_edit, 'label': self.label_line_edit, 'name': self.name_line_edit, 'icon': self.icon_path_line_edit} # tool buttons delete_button = QtWidgets.QPushButton('Delete') delete_button.setProperty('class', 'basic') open_button = QtWidgets.QPushButton('Open in Editor') open_button.setProperty('class', 'basic') self.save_button = QtWidgets.QPushButton('Save All') self.save_button.setProperty('class', 'basic') # Text Edit self.code_text_edit = QtWidgets.QPlainTextEdit() metrics = QtGui.QFontMetrics(self.code_text_edit.font()) self.code_text_edit.setTabStopWidth(4 * metrics.width(' ')) Highlighter(self.code_text_edit.document()) # Layout the Grid grid_layout.addWidget(label_label, 0, 0) grid_layout.addWidget(self.label_line_edit, 0, 1) grid_layout.addWidget(module_label, 1, 0) grid_layout.addWidget(self.command_line_edit, 1, 1) grid_layout.addWidget(required_label, 2, 0) grid_layout.addWidget(self.required_line_edit, 2, 1) grid_layout.addWidget(self.icon_label, 3, 0) grid_layout.addWidget(self.icon_path_line_edit, 3, 1) grid_layout.addWidget(icon_button, 3, 2) grid_layout.addWidget(name_label, 4, 0) grid_layout.addWidget(self.name_line_edit, 4, 1) name_label.hide() self.name_line_edit.hide() if self.menu_type != 'shelves': self.icon_label.hide() self.icon_path_line_edit.hide() icon_button.hide() else: self.required_line_edit.hide() required_label.hide() # Layout the tool row tool_row.addStretch(1) tool_row.addWidget(open_button) tool_row.addWidget(delete_button) tool_row.addWidget(self.save_button) # layout the widget layout.addLayout(grid_layout) layout.addWidget(self.code_text_edit) layout.addLayout(tool_row) # Signals and Slots self.code_text_edit.textChanged.connect(self.on_code_changed) icon_button.clicked.connect(self.on_icon_button_clicked) delete_button.clicked.connect(self.on_delete_clicked) open_button.clicked.connect(self.on_open_clicked) self.save_button.clicked.connect(self.on_save_clicked) self.load_attrs() self.label_line_edit.textChanged.connect(self.on_code_changed)
def __init__(self, parent=None): LJDialog.__init__(self, parent) self.setWindowTitle('RoboGary') trifecta_layout = QtWidgets.QHBoxLayout(self) trifecta_layout.setContentsMargins(0, 96, 0, 96) highlight_icon = os.path.join(icon_path(), 'highlight_24px.png') # self.transcript_file = r'B:\Users\tmiko\Downloads\tom_ahmed_conversation_12_10_2019.json' self.transcript_file = r'\\Mac\Home\Downloads\tom_ahmed_conversation_12_10_2019.json' self.transcript = load_json(self.transcript_file) self.words = self.transcript['results']['items'] self.next_words_length = 5 self.cgl_word_dict = self.create_cgl_word_dict() self.tools_layout = QtWidgets.QVBoxLayout() self.script_layout = QtWidgets.QVBoxLayout() self.title_line_edit = QtWidgets.QLineEdit() self.gridA = QtWidgets.QGridLayout() self.gridA.setContentsMargins(96, 0, 0, 12) self.grid = QtWidgets.QGridLayout() self.grid.setContentsMargins(96, 0, 0, 0) # Screenplay stuff self.title_label = QtWidgets.QLabel('TITLE:') self.title_line_edit.setProperty('class', 'screen_play_edit') self.title_line_edit.setText('TYPE TITLE HERE') self.screenplay_text_edit = ScreenPlayTextEdit() self.screenplay_text_edit.setProperty('class', 'screen_play') self.width = 816 self.screenplay_text_edit.setMinimumWidth(self.width) self.screenplay_text_edit.setMaximumWidth(self.width) self.punctuation = [',', '.', '?'] # Details stuff self.description_label = QtWidgets.QLabel("DESCRIPTION:") self.description_line_edit = QtWidgets.QLineEdit('TYPE DESCRIPTION HERE') self.description_line_edit.setProperty('class', 'screen_play_edit') self.location_label = QtWidgets.QLabel("LOCATION: ") self.location_line_edit = QtWidgets.QLineEdit('TYPE LOCATION HERE') self.location_line_edit.setProperty('class', 'screen_play_edit') self.date_label = QtWidgets.QLabel("DATE: ") self.date_line_edit = QtWidgets.QLineEdit('TYPE DATE HERE') self.date_line_edit.setProperty('class', 'screen_play_edit') self.selection_start_label = QtWidgets.QLabel("Start:") self.selection_start_line_edit = QtWidgets.QLineEdit() self.selection_end_label = QtWidgets.QLabel("End:") self.selection_end_line_edit = QtWidgets.QLineEdit() # grid self.gridA.addWidget(self.title_label, 10, 0) self.gridA.addWidget(self.title_line_edit, 10, 1) self.grid.addWidget(self.description_label, 11, 0) self.grid.addWidget(self.description_line_edit, 11, 1) self.grid.addWidget(self.location_label, 12, 0) self.grid.addWidget(self.location_line_edit, 12, 1) self.grid.addWidget(self.date_label, 13, 0) self.grid.addWidget(self.date_line_edit, 13, 1) self.grid.addWidget(self.selection_start_label, 14, 0) self.grid.addWidget(self.selection_start_line_edit, 14, 1) self.grid.addWidget(self.selection_end_label, 15, 0) self.grid.addWidget(self.selection_end_line_edit, 15, 1) # Toolbar toolbar = QtWidgets.QHBoxLayout() toolbar.setContentsMargins(96, 0, 0, 0) self.script_layout.addLayout(self.gridA) self.script_layout.addLayout(toolbar) self.script_layout.addWidget(self.screenplay_text_edit) self.tools_layout.addLayout(self.grid) self.highlight_button = QtWidgets.QToolButton() self.highlight_button.setIcon(QtGui.QIcon(highlight_icon)) toolbar.addWidget(self.highlight_button) toolbar.addStretch(1) trifecta_layout.addLayout(self.script_layout) trifecta_layout.addLayout(self.tools_layout) self.tools_layout.addStretch(1) self.highlight_button.clicked.connect(self.on_highlight_clicked) self.screenplay_text_edit.selectionChanged.connect(self.on_selected) self.load_transcript()
def __init__(self, parent=None, path_object=None): QtWidgets.QFrame.__init__(self, parent) if path_object: self.path_object = path_object else: return self.setProperty('class', 'light_grey') self.my_tasks_button = QtWidgets.QPushButton() self.my_tasks_button.setToolTip('My Tasks') tasks_icon = os.path.join(cglpath.icon_path(), 'star24px.png') self.my_tasks_button.setProperty('class', 'grey_border') self.my_tasks_button.setIcon(QtGui.QIcon(tasks_icon)) self.my_tasks_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.refresh_button = QtWidgets.QPushButton() self.refresh_button.setToolTip('Refresh') refresh_icon = os.path.join(cglpath.icon_path(), 'spinner11.png') self.refresh_button.setProperty('class', 'grey_border') self.refresh_button.setIcon(QtGui.QIcon(refresh_icon)) self.refresh_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.ingest_button = QtWidgets.QPushButton() self.ingest_button.setToolTip('My Tasks') self.ingest_button.setProperty('class', 'grey_border') ingest_icon = os.path.join(cglpath.icon_path(), 'ingest24px.png') self.ingest_button.setIcon(QtGui.QIcon(ingest_icon)) self.ingest_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.back_button = QtWidgets.QPushButton() self.back_button.setToolTip('Go back') self.projects_button = QtWidgets.QPushButton() self.projects_button.setToolTip('Go to Projects') self.companies_button = QtWidgets.QPushButton() self.companies_button.setToolTip('Go to Companies') self.my_tasks_button.setProperty('class', 'grey_border') self.back_button.setStyleSheet("background: transparent;") self.projects_button.setStyleSheet("background: transparent;") self.companies_button.setStyleSheet("background: transparent;") back_icon = os.path.join(cglpath.icon_path(), 'back24px.png') home_icon = os.path.join(cglpath.icon_path(), 'project24px.png') company_icon = os.path.join(cglpath.icon_path(), 'company24px.png') self.back_button.setIcon(QtGui.QIcon(back_icon)) self.back_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.companies_button.setIcon(QtGui.QIcon(company_icon)) self.companies_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.projects_button.setIcon(QtGui.QIcon(home_icon)) self.projects_button.setIconSize(QtCore.QSize(ICON_WIDTH, ICON_WIDTH)) self.current_location_line_edit = QtWidgets.QLineEdit() self.current_location_line_edit.setReadOnly(True) self.current_location_line_edit.setMinimumHeight(ICON_WIDTH * 1.28) self.current_location_line_edit.hide() self.search_box = LJSearchEdit(self) layout = QtWidgets.QVBoxLayout(self) self.cl_row = QtWidgets.QHBoxLayout() self.cl_row.addWidget(self.back_button) self.cl_row.addWidget(self.companies_button) self.cl_row.addWidget(self.projects_button) self.cl_row.addWidget(self.my_tasks_button) self.cl_row.addWidget(self.refresh_button) self.cl_row.addWidget(self.search_box) self.cl_row.addWidget(self.ingest_button) layout.addLayout(self.cl_row) layout.addWidget(self.current_location_line_edit) self.my_tasks_button.clicked.connect(self.my_tasks_pressed) self.ingest_button.clicked.connect(self.ingest_clicked) self.refresh_button.clicked.connect(self.refresh_clicked) self.back_button.clicked.connect(self.back_button_pressed) self.companies_button.clicked.connect(self.buttons_pressed) self.projects_button.clicked.connect(self.buttons_pressed) self.set_text(self.path_object.path_root)