def UI(self): self.setWindowTitle("HDR Choice") main_layout = gui.QHBoxLayout(self) #Left Layout self.left_group = gui.QGroupBox(self) self.left_group_layout = gui.QGridLayout(self) self.left_group.setLayout(self.left_group_layout) #HDR Combobox self.hdr_combobox = gui.QComboBox() os.chdir(self.hdr_path) for file in glob.glob("*.HDR"): #Get HDR in folder split_file = file.split(".")[0] self.hdr_list.append(split_file) num = 0 for maps in self.hdr_list: #Add Maps in combobox self.hdr_combobox.insertItem(num, maps) num = num + 1 self.left_group_layout.addWidget(self.hdr_combobox) # #Thumbnail viewer self.thumb_view = gui.QLabel() self.selection = self.hdr_combobox.currentText self.pixmap = gui.QPixmap(self.thumb_path + "\\" + self.selection + "_thumb.jpg") self.thumb_view.setPixmap(self.pixmap) self.left_group_layout.addWidget(self.thumb_view) self.hdr_combobox.connect("currentIndexChanged(int)", self.change_hdr_pixmap) #Apply HDR apply_hdr = gui.QPushButton("Apply HDR") self.left_group_layout.addWidget(apply_hdr) apply_hdr.connect("clicked()", self.applyHDR) # Add Layout to main main_layout.addWidget(self.left_group)
def ui_n_stuff(self): # Variables necessaires self.geo_list = mari.geo.list() obj = mari.geo.current() obj_name = str(obj.name()) obj_name = obj_name.split("_")[0] self.path_export = "Z:\\Groupes-cours\\NAND999-A15-N01\\Nature\\assets\\tex\\" + obj_name + "\\" self.nomenclature = "$CHANNEL.png" # Construire la fenetre et le layout de base self.setWindowTitle("Export Manager") main_layout = gui.QHBoxLayout(self) close_layout = gui.QVBoxLayout(self) # Layout pour section du top top_group = gui.QGroupBox() top_group_layout = gui.QVBoxLayout() top_group.setLayout(top_group_layout) # Layout pour section du bot bottom_group = gui.QGroupBox() bottom_group_layout = gui.QVBoxLayout() bottom_group.setLayout(bottom_group_layout) # Ajouter Group Widget au main Layout main_layout.addWidget(top_group) main_layout.addWidget(bottom_group) # Channel Header, Label et Widgets channel_label = gui.QLabel("<strong>Channels To Export</strong>") channel_layout = gui.QVBoxLayout() channel_header_layout = gui.QHBoxLayout() # Layout Channel channel_header_layout.addWidget(channel_label) channel_header_layout.addStretch() channel_layout.addLayout(channel_header_layout) top_group_layout.addLayout(channel_layout) # -----------------------------BUTTON & WIDGETS--------------------------------- # Repopulate the earth chan_dict = {} self.checkbox_dict = {} checkbox_liste = [] checkbox_group = gui.QGroupBox() checkbox_group_layout = gui.QVBoxLayout() checkbox_group.setLayout(checkbox_group_layout) top_group_layout.addWidget(checkbox_group) # Label & Checkbox builder geo_dict = {} for geo in self.geo_list: # Iterating over each object (geo = Cube, Sphere, Torus) obj_label = gui.QLabel(str(geo.name())) checkbox_group_layout.addWidget(obj_label) for channel in geo.channelList(): # Iterating over each channel (channel = Diffuse, Spec, Bump...) checkbox = gui.QCheckBox(str(channel.name())) checkbox_group_layout.addWidget(checkbox) self.checkbox_dict[checkbox] = channel # Path Layout path_layout = gui.QHBoxLayout() # Ajouter un label, bouton et text field pour le path path_label = gui.QLabel('Path:') # Label avant le lineEdit path_line_edit = gui.QLineEdit(self.path_export) # Texte sur la ligne path_line_edit.setDisabled(1) path_line_edit.setReadOnly(1) # Read Only mode, can select can't change path_pixmap = gui.QPixmap(mari.resources.path(mari.resources.ICONS) + '/ExportImages.png') icon = gui.QIcon(path_pixmap) path_button = gui.QPushButton(icon, "") path_layout.addWidget(path_label) path_layout.addWidget(path_line_edit) path_layout.addWidget(path_button) bottom_group_layout.addLayout(path_layout) # Select All & Select None Button sel_all = gui.QPushButton("Select All") sel_none = gui.QPushButton("Select None") top_group_layout.addWidget(sel_all) top_group_layout.addWidget(sel_none) sel_all.connect("clicked()", self.select_all) # Connect button to fonction sel_none.connect("clicked()", self.select_none) # Connect button to fonction # Export All & Export Button export_all = gui.QPushButton("Export All") export_selected = gui.QPushButton("Export Selected") bottom_group_layout.addWidget(export_all) bottom_group_layout.addWidget(export_selected) export_all.connect("clicked()", self.export_all_fc) # Connect button to fonction export_selected.connect("clicked()", self.export_selected_fc) # Connect button to fonction # Close button close_btn = gui.QPushButton("Close") close_layout.addWidget(close_btn) main_layout.addLayout(close_layout, stretch=1) close_btn.connect("clicked()", self.reject) # Connect button to fonction
def change_hdr_pixmap(self): selected_hdr = self.hdr_combobox.currentText self.pixmap = gui.QPixmap(self.thumb_path + "\\" + selected_hdr + "_thumb.jpg") self.thumb_view.setPixmap(self.pixmap)