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 __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)
def paintEvent(self, event): mouse_pos = self.mapFromGlobal(QtGui.QCursor.pos()) click_pos = None if self.click_position is not None: click_pos = self.mapFromGlobal(self.click_position) qp = QtGui.QPainter(self) # initialize the crosshairs qp.setBrush(QtGui.QColor(0, 0, 0, 1)) qp.setPen(QtCore.Qt.NoPen) qp.drawRect(event.rect()) # Clear the capture area if click_pos is not None: self.rectangle = QtCore.QRect(click_pos, mouse_pos) qp.setCompositionMode(QtGui.QPainter.CompositionMode_Clear) qp.drawRect(self.rectangle) qp.setCompositionMode(QtGui.QPainter.CompositionMode_SourceOver) pen = QtGui.QPen(QtGui.QColor('white'), 3, QtCore.Qt.SolidLine) qp.setPen(pen) # Draw cropping markers at click position if click_pos is not None: # left line qp.drawLine(mouse_pos.x(), click_pos.y(), mouse_pos.x(), mouse_pos.y()) # top line qp.drawLine(click_pos.x(), click_pos.y(), mouse_pos.x(), click_pos.y()) # right line qp.drawLine(click_pos.x(), click_pos.y(), click_pos.x(), mouse_pos.y()) # bottom line qp.drawLine(click_pos.x(), mouse_pos.y(), mouse_pos.x(), mouse_pos.y())
def load_assets(self): red_palette = QtGui.QPalette() red_palette.setColor(self.foregroundRole(), QtGui.QColor(255, 0, 0)) self.assets.data_table.clearSpans() items = glob.glob(self.path_object.path_root) data = [] temp_ = [] self.assets.add_button.clicked.connect(self.on_create_asset) d = None if items: self.assets.data_table.show() self.assets.search_box.show() self.assets.message.hide() self.assets.message.setText('') for each in items: obj_ = PathObject(str(each)) d = obj_.data shot_name = '%s_%s' % (d['seq'], d['shot']) if shot_name not in temp_: temp_.append(shot_name) if d['scope'] == 'assets': data.append([d['seq'], d['shot'], each, '', '', '']) elif d['scope'] == 'shots': data.append([d['seq'], shot_name, each, '', '', '']) if d['scope'] == 'assets': self.assets.setup( ListItemModel(data, [ 'Category', 'Name', 'Path', 'Due Date', 'Status', 'Task' ])) elif d['scope'] == 'shots': self.assets.setup( ListItemModel( data, ['Seq', 'Shot', 'Path', 'Due Date', 'Status', 'Task'])) self.assets.data_table.hideColumn(0) self.assets.data_table.hideColumn(2) self.assets.data_table.hideColumn(3) self.assets.data_table.hideColumn(5) else: self.assets.data_table.hide() self.assets.message.setText( 'No %s Found! \nClick + button to create %s' % (self.path_object.scope.title(), self.path_object.scope)) self.assets.message.setPalette(red_palette) self.assets.message.show()
def app_init(splash_image='lubmermill.jpg'): from cgl.core.path import image_path app_ = QtWidgets.QApplication([]) splash_pix = QtGui.QPixmap(image_path(splash_image)) splash_ = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash_.setMask(splash_pix.mask()) splash_.show() app_.setStyleSheet(load_style_sheet()) return app_, splash_
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 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 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 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 __init__(self, parent=None, path_object=None, search_box=None): QtWidgets.QWidget.__init__(self, parent) self.search_box = search_box self.path_object = path_object self.panel = QtWidgets.QVBoxLayout(self) pixmap = QtGui.QPixmap(icon_path('company24px.png')) #self.company_widget = LJListWidget('Companies', pixmap=pixmap, search_box=search_box) self.data_table = LJTableWidget(self, path_object=self.path_object) self.company_widget.add_button.setText('add company') self.company_widget.list.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) self.user_root = CONFIG['cg_lumberjack_dir'] self.panel.addWidget(self.company_widget) self.panel.addStretch(0) self.load_companies() self.project_management = 'lumbermill' self.company_widget.add_button.clicked.connect(self.on_create_company) self.company_widget.list.itemDoubleClicked.connect( self.on_company_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.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, project_management=None, user_email=None, company=None, path=None, radio_filter=None, show_import=False): QtWidgets.QWidget.__init__(self, parent) try: font_db = QtGui.QFontDatabase() font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ARCADECLASSIC.TTF')) font_db.addApplicationFont( os.path.join(cglpath.font_path(), 'ka1.ttf')) except AttributeError: logging.error('Skipping Loading Fonts - possible Pyside2 issue') # Environment Stuff self.show_import = show_import self.user_email = user_email self.company = company self.project_management = project_management self.root = CONFIG['paths']['root'] # Company Specific self.user_root = CONFIG['cg_lumberjack_dir'] self.context = 'source' self.path_object = None self.panel = None self.radio_filter = radio_filter self.source_selection = [] self.setMinimumWidth(840) self.setMinimumHeight(800) self.frame_range = None self.layout = QtWidgets.QVBoxLayout(self) self.setContentsMargins(0, 0, 0, 0) self.layout.setContentsMargins(0, 0, 0, 0) if path: try: self.path_object = cglpath.PathObject(path) if self.path_object.context == 'render': self.path_object.set_attr(context='source') self.path_object.set_attr(resolution=None) self.path_object.set_attr(version=None) self.path_object.set_attr(user='') if not self.path_object.task: self.path_object.set_attr(task='*') self.path_object.set_attr(filename='') self.path_object.set_attr(ext='') except IndexError: logging.error('Path is not set') pass else: self.path_object = cglpath.PathObject(self.root) # self.project = '*' self.scope = 'assets' self.shot = '*' self.seq = '*' self.ingest_source = '*' if self.path_object: if self.path_object.project: self.project = self.path_object.project if self.path_object.scope: self.scope = self.path_object.scope if self.path_object.shot: self.shot = self.path_object.shot if self.path_object.seq: self.seq = self.path_object.seq self.user_favorites = '' self.task = '' self.resolution = '' self.in_file_tree = None self.nav_widget = NavigationWidget(path_object=self.path_object) self.path_widget = PathWidget(path_object=self.path_object) self.progress_bar = ProgressGif() self.progress_bar.hide() # self.nav_widget.update_buttons() self.path_widget.update_path(path_object=self.path_object) self.nav_widget.location_changed.connect(self.update_location) self.nav_widget.refresh_button_clicked.connect( self.update_location_to_latest) self.nav_widget.my_tasks_clicked.connect(self.show_my_tasks) self.nav_widget.location_changed.connect(self.path_widget.update_path) self.layout.addWidget(self.nav_widget) self.update_location(self.path_object)
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, 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)
def __init__(self, show_import=False, user_info=None, start_time=None, previous_path=None): LJMainWindow.__init__(self) if start_time: print 'Finished Loading Modules in %s seconds' % (time.time() - start_time) self.user_config = UserConfig().d if previous_path: self.previous_path = previous_path self.previous_paths = [] else: self.previous_path = self.user_config['previous_path'] self.previous_paths = self.user_config['previous_paths'] self.filter = 'Everything' self.project_management = CONFIG['account_info']['project_management'] self.user_info = '' self.user_email = '' self.user_name = '' self.company = '' self.pd_menus = {} self.menu_dict = {} self.menus = {} self.setCentralWidget( CGLumberjackWidget(self, project_management=self.project_management, user_email=user_info['login'], company=self.company, path=self.previous_path, radio_filter=self.filter, show_import=show_import)) if user_info['first']: self.setWindowTitle('Lumbermill - Logged in as %s' % user_info['first']) else: self.setWindowTitle('Lumbermill - Logged in as %s' % user_info['login']) self.status_bar = QtWidgets.QStatusBar() self.setStatusBar(self.status_bar) # Load Style Sheet and set up Styles: w = 400 h = 500 self.resize(w, h) self.menu_bar = self.menuBar() self.two_bar = self.menuBar() icon = QtGui.QPixmap(":/images/lumberjack.24px.png").scaled(24, 24) self.setWindowIcon(icon) login = QtWidgets.QAction('login', self) time_tracking = QtWidgets.QAction('time', self) proj_man = QtWidgets.QAction('%s' % self.project_management, self) update_button = QtWidgets.QAction('Check For Updates', self) report_bug_button = QtWidgets.QAction('Report Bug', self) request_feature_button = QtWidgets.QAction('Request Feature', self) tools_menu = self.menu_bar.addMenu('&Tools') sync_menu = self.menu_bar.addMenu('&Sync') if self.project_management != 'lumbermill': self.proj_man_link = self.two_bar.addAction(proj_man) self.login_menu = self.two_bar.addAction(login) self.two_bar.addAction(time_tracking) settings = QtWidgets.QAction('Settings', self) open_globals = QtWidgets.QAction('Go to Company Globals', self) open_user_globals = QtWidgets.QAction('Go to User Globals', self) create_project = QtWidgets.QAction('Import .csv', self) settings.setShortcut('Ctrl+,') pipeline_designer = QtWidgets.QAction('Pipeline Designer', self) set_up_sync_thing_server = QtWidgets.QAction('Set up Server', self) set_up_sync_thing_workstation = QtWidgets.QAction( 'Set Up Workstation', self) check_machines_action = QtWidgets.QAction('Check for new Machines', self) add_machines_to_folders = QtWidgets.QAction( 'Share Folders With Machines', self) pull_from_server = QtWidgets.QAction('Pull from Server', self) manage_sharing_action = QtWidgets.QAction('Manage Sharing', self) launch_syncthing = QtWidgets.QAction('Relaunch Sync', self) kill_syncthing = QtWidgets.QAction('Kill Sync', self) fix_paths = QtWidgets.QAction('Fix File Paths', self) # add actions to the file menu tools_menu.addAction(settings) tools_menu.addAction(open_globals) tools_menu.addAction(open_user_globals) tools_menu.addSeparator() tools_menu.addAction(create_project) tools_menu.addAction(pipeline_designer) tools_menu.addSeparator() tools_menu.addAction(update_button) tools_menu.addAction(report_bug_button) tools_menu.addAction(request_feature_button) # connect signals and slots sync_menu.addAction(manage_sharing_action) sync_menu.addSeparator() sync_menu.addAction(set_up_sync_thing_server) sync_menu.addAction(check_machines_action) sync_menu.addAction(add_machines_to_folders) sync_menu.addSeparator() sync_menu.addAction(set_up_sync_thing_workstation) sync_menu.addAction(pull_from_server) sync_menu.addAction(fix_paths) sync_menu.addSeparator() sync_menu.addAction(kill_syncthing) sync_menu.addAction(launch_syncthing) # connect signals and slots kill_syncthing.triggered.connect(self.on_kill_syncthing) launch_syncthing.triggered.connect(self.on_launch_syncthing) pull_from_server.triggered.connect( self.enable_server_connection_clicked) check_machines_action.triggered.connect( self.check_for_machines_clicked) sync_menu.triggered.connect(self.add_machines_to_folders_clicked) manage_sharing_action.triggered.connect( self.manage_sharing_action_clicked) set_up_sync_thing_server.triggered.connect( self.set_up_st_server_clicked) set_up_sync_thing_workstation.triggered.connect( self.set_up_st_workstation_clicked) fix_paths.triggered.connect(self.fix_paths_clicked) open_globals.triggered.connect(self.open_company_globals) open_user_globals.triggered.connect(self.open_user_globals) create_project.triggered.connect(self.open_create_project_dialog) settings.triggered.connect(self.on_settings_clicked) pipeline_designer.triggered.connect(self.on_menu_designer_clicked) login.triggered.connect(self.on_login_clicked) proj_man.triggered.connect(self.on_proj_man_menu_clicked) update_button.triggered.connect(self.update_lumbermill_clicked) report_bug_button.triggered.connect(self.report_bug_clicked) request_feature_button.triggered.connect(self.feature_request_clicked) time_tracking.triggered.connect(self.time_tracking_clicked) # Load any custom menus that the user has defined self.load_pipeline_designer_menus()