def build_widget(self): """ Building the widgets for client items. """ self._add_file_btn = QtWidgets.QPushButton() self._add_file_btn.setText('Add Single Client File') self._add_folder_btn = QtWidgets.QPushButton() self._add_folder_btn.setText('Add Client Folder') self._remove_btn = QtWidgets.QPushButton() self._remove_btn.setText('Remove Client File/Folder')
def build_widget(self): self._h_layout = QtWidgets.QHBoxLayout() spacer = QtWidgets.QSpacerItem(20, 20) self._integrate_location_label = QtWidgets.QLabel() self._integrate_location_label.setText('Output Location: {}'.format( self.add_configuration.output_location)) self._integrate_location_changeBtn = QtWidgets.QPushButton() self._integrate_location_changeBtn.setMaximumHeight(23) self._integrate_location_changeBtn.setText('Change') self._logging_location_label = QtWidgets.QLabel() self._logging_location_label.setText('Logging Location: {}'.format( self.add_configuration.logging_location)) self._logging_location_changeBtn = QtWidgets.QPushButton() self._logging_location_changeBtn.setMaximumHeight(23) self._logging_location_changeBtn.setText('Change') self._logging_status = QtWidgets.QLabel() self._logging_status.setText('Logging: ') self._logging_status_checkBox = QtWidgets.QCheckBox() self._logging_status_checkBox.setChecked( self.add_configuration.logging_option) self._h_layout.addWidget(self._integrate_location_label) self._h_layout.addWidget(self._integrate_location_changeBtn) self._h_layout.addItem(spacer) self._h_layout.addWidget(self._logging_location_label) self._h_layout.addWidget(self._logging_location_changeBtn) self._h_layout.addItem(spacer) self._h_layout.addWidget(self._logging_status) self._h_layout.addWidget(self._logging_status_checkBox) self.setLayout(self._h_layout)
def launchUI(): """ Opening the UI and resizing the window """ app = QtWidgets.QApplication(sys.argv) ui = ClientFileManager() ui.resize(1200, 650) ui.show() sys.exit(app.exec_())
def __init__(self, parent=None): super(ClientFileManager, self).__init__(parent=parent) # setting up the UI self.setWindowTitle(self._OBJ_NAME) self.setStyleSheet(read_css()) self.centralwidget = QtWidgets.QWidget(self) self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.configuration_widgets = AddConfigurationWidgets( parent=self.centralwidget) self.configuration_widgets_grp = GroupWidgets( [self.configuration_widgets], 'Configuration') self.save_configuration = AddSaveConfigurationWidget( parent=self.centralwidget) self.save_configuration_grp = GroupWidgets([self.save_configuration], '') # Creating the tree widget self.tree_widget = CustomTreeWidget(parent=self.centralwidget) self.tree_grp = GroupWidgets([self.tree_widget], 'Client Files') # Add Buttons to add or remove files/Folders self.client_buttons = AddClientItemsButtons(parent=self.centralwidget) self.client_buttons_grp = GroupWidgets([self.client_buttons], 'Add Client Files') self.integrate_buttons = AddIntegrateButton(parent=self.centralwidget) self.integrate_buttons_grp = GroupWidgets([self.integrate_buttons], 'Integrate') # adding the widgets to the layout self.verticalLayout.addWidget(self.configuration_widgets_grp) self.verticalLayout.addWidget(self.save_configuration_grp) self.verticalLayout.addWidget(self.tree_grp) self.verticalLayout.addWidget(self.client_buttons_grp) self.verticalLayout.addWidget(self.integrate_buttons_grp) self.setCentralWidget(self.centralwidget) self.build_connections()
def build_widget_items(self, top_item): """ Building the QTreeWidgetItems for the QTreeWidget Args: top_item (QTreeWidget): The top item the widgets will be parented to. Single items will only be parented to QTreeWidget. Folders will be parented to the first item widget. """ ## Column 0 - Input: self._folder_widget = QtWidgets.QLabel() self._folder_widget.setText(self._folder) top_item.setItemWidget(self, 0, self._folder_widget) ## Column 1 - filename: self._filename_widget = QtWidgets.QLabel() self._filename_widget.setText(self._filename) self._filename_widget.setAlignment(QtCore.Qt.AlignCenter) top_item.setItemWidget(self, 1, self._filename_widget) ## Column 1 - Sequence: self._sequence_widget = QtWidgets.QComboBox() self._sequence_widget.addItem(self._sequence) self._sequence_widget.setEditable(True) top_item.setItemWidget(self, 2, self._sequence_widget) { self._sequence_widget.addItem(os.path.basename(key)) for (key, value) in self._app_config.add_configuration.output_subfolders.items() } self._sequence_widget.currentIndexChanged.connect(self.update_shot_wdgs) ## Column 2 - Shot: self._shot_widget = QtWidgets.QComboBox() self._shot_widget.addItem(self._shot) self._shot_widget.setEditable(True) top_item.setItemWidget(self, 3, self._shot_widget) ## Column 3 - Location self._location_widget = QtWidgets.QComboBox() self._location_widget.addItem(str(self._location)) self._location_widget.setEditable(True) top_item.setItemWidget(self, 4, self._location_widget) ## Column 4 - Option self._option_widget = QtWidgets.QComboBox() [self._option_widget.addItem(option) for option in self._OPTIONS] top_item.setItemWidget(self, 5, self._option_widget) self.option_override() self._option_widget.currentIndexChanged.connect(self.option_override) # If the header file is passed, some overrides need to be set to allow # an easier override option for all sub items if self._header: self._option_widget.currentIndexChanged.connect(self.header_option_override) self._location_widget.currentTextChanged.connect(self.header_location_override) self._sequence_widget.currentTextChanged.connect(self.header_sequence_override) self._shot_widget.currentTextChanged.connect(self.header_shot_override)
def open_folder(instance, title, location, filter): """ Opening a file dialog to select a folder to items to be ingested. Arguments: instance {MainClassInstance} -- The main ingest window instance. title {str} -- The title of the dialog window. location {str} -- The location of where the file dialog will open up to. filter {str} -- The filter to be used on what can be added. Returns: path -- A path object of the folder location that has been selected. """ dialog = QtWidgets.QFileDialog(instance, title, location, filter) dialog.setFileMode(QtWidgets.QFileDialog.DirectoryOnly) if not dialog.exec_() == QtWidgets.QDialog.Accepted: return False return Path(dialog.selectedFiles()[0])
def __init__(self, parent): super(BaseAddItems, self).__init__(parent) self._h_layout = QtWidgets.QHBoxLayout() # setting the main layout self.build_widget() # building the widget contents self.set_layout() # adding all items to the main layout
def __init__(self, widgets, title, margin=0, parent=None): super(GroupWidgets, self).__init__(title, parent) self.setFlat(True) self.setLayout(QtWidgets.QVBoxLayout()) self.layout().setContentsMargins(margin, margin, margin, margin) [self.layout().addWidget(widget) for widget in widgets]
def build_widget(self): self._save_configuration_btn = QtWidgets.QPushButton() self._save_configuration_btn.setText( 'Save Configuration Changes To File')
def build_widget(self): self._integrate_btn = QtWidgets.QPushButton() self._integrate_btn.setText('Integrate Client Files')