def _setup_ui(self): self.setStyleSheet(self._default) self.setFixedWidth(300) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setWidget(ShotList()) self.addWidget(scroll)
def do_layout(self): self.central_widget.clear() self.labels = [] sto = QWidget.setTabOrder self.central_widget.tabBar().setVisible(False) tab0 = QWidget(self) self.central_widget.addTab(tab0, _("&Metadata")) l = QGridLayout() tab0.setLayout(l) # Basic metadata in col 0 tl = QGridLayout() gb = QGroupBox(_('Basic metadata'), tab0) l.addWidget(gb, 0, 0, 1, 1) gb.setLayout(tl) self.button_box_layout.insertWidget(1, self.fetch_metadata_button) self.button_box_layout.insertWidget(2, self.config_metadata_button) sto(self.button_box, self.fetch_metadata_button) sto(self.fetch_metadata_button, self.config_metadata_button) sto(self.config_metadata_button, self.title) def create_row(row, widget, tab_to, button=None, icon=None, span=1): ql = BuddyLabel(widget) tl.addWidget(ql, row, 1, 1, 1) tl.addWidget(widget, row, 2, 1, 1) if button is not None: tl.addWidget(button, row, 3, span, 1) if icon is not None: button.setIcon(QIcon(I(icon))) if tab_to is not None: if button is not None: sto(widget, button) sto(button, tab_to) else: sto(widget, tab_to) tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1) tl.addWidget(self.manage_authors_button, 2, 0, 2, 1) tl.addWidget(self.paste_isbn_button, 12, 0, 1, 1) tl.addWidget(self.tags_editor_button, 6, 0, 1, 1) create_row(0, self.title, self.title_sort, button=self.deduce_title_sort_button, span=2, icon='auto_author_sort.png') create_row(1, self.title_sort, self.authors) create_row(2, self.authors, self.author_sort, button=self.deduce_author_sort_button, span=2, icon='auto_author_sort.png') create_row(3, self.author_sort, self.series) create_row(4, self.series, self.series_index, button=self.clear_series_button, icon='trash.png') create_row(5, self.series_index, self.tags) create_row(6, self.tags, self.rating, button=self.clear_tags_button) create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button) create_row(8, self.pubdate, self.publisher, button=self.pubdate.clear_button, icon='trash.png') create_row(9, self.publisher, self.languages, button=self.publisher.clear_button, icon='trash.png') create_row(10, self.languages, self.timestamp) create_row(11, self.timestamp, self.identifiers, button=self.timestamp.clear_button, icon='trash.png') create_row(12, self.identifiers, self.comments, button=self.clear_identifiers_button, icon='trash.png') sto(self.clear_identifiers_button, self.swap_title_author_button) sto(self.swap_title_author_button, self.manage_authors_button) sto(self.manage_authors_button, self.tags_editor_button) sto(self.tags_editor_button, self.paste_isbn_button) tl.addItem(QSpacerItem(1, 1, QSizePolicy.Fixed, QSizePolicy.Expanding), 13, 1, 1 ,1) # Custom metadata in col 1 w = getattr(self, 'custom_metadata_widgets_parent', None) if w is not None: gb = QGroupBox(_('Custom metadata'), tab0) gbl = QVBoxLayout() gb.setLayout(gbl) sr = QScrollArea(gb) sr.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) sr.setWidgetResizable(True) sr.setFrameStyle(QFrame.NoFrame) sr.setWidget(w) gbl.addWidget(sr) l.addWidget(gb, 0, 1, 1, 1) sp = QSizePolicy() sp.setVerticalStretch(10) sp.setHorizontalPolicy(QSizePolicy.Minimum) sp.setVerticalPolicy(QSizePolicy.Expanding) gb.setSizePolicy(sp) self.set_custom_metadata_tab_order() # comments span col 0 & 1 w = QGroupBox(_('Comments'), tab0) sp = QSizePolicy() sp.setVerticalStretch(10) sp.setHorizontalPolicy(QSizePolicy.Expanding) sp.setVerticalPolicy(QSizePolicy.Expanding) w.setSizePolicy(sp) lb = QHBoxLayout() w.setLayout(lb) lb.addWidget(self.comments) l.addWidget(w, 1, 0, 1, 2) # Cover & formats in col 3 gb = QGroupBox(_('Cover'), tab0) lb = QGridLayout() gb.setLayout(lb) lb.addWidget(self.cover, 0, 0, 1, 3, alignment=Qt.AlignCenter) sto(self.manage_authors_button, self.cover.buttons[0]) for i, b in enumerate(self.cover.buttons[:3]): lb.addWidget(b, 1, i, 1, 1) sto(b, self.cover.buttons[i+1]) hl = QHBoxLayout() for b in self.cover.buttons[3:]: hl.addWidget(b) sto(self.cover.buttons[-2], self.cover.buttons[-1]) lb.addLayout(hl, 2, 0, 1, 3) l.addWidget(gb, 0, 2, 1, 1) l.addWidget(self.formats_manager, 1, 2, 1, 1) sto(self.cover.buttons[-1], self.formats_manager) self.formats_manager.formats.setMaximumWidth(10000) self.formats_manager.formats.setIconSize(QSize(32, 32))
def do_layout(self): self.central_widget.clear() self.labels = [] sto = QWidget.setTabOrder self.central_widget.tabBar().setVisible(False) tab0 = QWidget(self) self.central_widget.addTab(tab0, _("&Metadata")) l = QGridLayout() tab0.setLayout(l) # Basic metadata in col 0 tl = QGridLayout() gb = QGroupBox(_('Basic metadata'), tab0) l.addWidget(gb, 0, 0, 1, 1) gb.setLayout(tl) self.button_box_layout.insertWidget(1, self.fetch_metadata_button) self.button_box_layout.insertWidget(2, self.config_metadata_button) sto(self.button_box, self.fetch_metadata_button) sto(self.fetch_metadata_button, self.config_metadata_button) sto(self.config_metadata_button, self.title) def create_row(row, widget, tab_to, button=None, icon=None, span=1): ql = BuddyLabel(widget) tl.addWidget(ql, row, 1, 1, 1) tl.addWidget(widget, row, 2, 1, 1) if button is not None: tl.addWidget(button, row, 3, span, 1) if icon is not None: button.setIcon(QIcon(I(icon))) if tab_to is not None: if button is not None: sto(widget, button) sto(button, tab_to) else: sto(widget, tab_to) tl.addWidget(self.swap_title_author_button, 0, 0, 2, 1) tl.addWidget(self.manage_authors_button, 2, 0, 2, 1) tl.addWidget(self.paste_isbn_button, 12, 0, 1, 1) tl.addWidget(self.tags_editor_button, 6, 0, 1, 1) create_row(0, self.title, self.title_sort, button=self.deduce_title_sort_button, span=2, icon='auto_author_sort.png') create_row(1, self.title_sort, self.authors) create_row(2, self.authors, self.author_sort, button=self.deduce_author_sort_button, span=2, icon='auto_author_sort.png') create_row(3, self.author_sort, self.series) create_row(4, self.series, self.series_index, button=self.clear_series_button, icon='trash.png') create_row(5, self.series_index, self.tags) create_row(6, self.tags, self.rating, button=self.clear_tags_button) create_row(7, self.rating, self.pubdate, button=self.clear_ratings_button) create_row(8, self.pubdate, self.publisher, button=self.pubdate.clear_button, icon='trash.png') create_row(9, self.publisher, self.languages) create_row(10, self.languages, self.timestamp) create_row(11, self.timestamp, self.identifiers, button=self.timestamp.clear_button, icon='trash.png') create_row(12, self.identifiers, self.comments, button=self.clear_identifiers_button, icon='trash.png') sto(self.clear_identifiers_button, self.swap_title_author_button) sto(self.swap_title_author_button, self.manage_authors_button) sto(self.manage_authors_button, self.tags_editor_button) sto(self.tags_editor_button, self.paste_isbn_button) tl.addItem(QSpacerItem(1, 1, QSizePolicy.Fixed, QSizePolicy.Expanding), 13, 1, 1, 1) # Custom metadata in col 1 w = getattr(self, 'custom_metadata_widgets_parent', None) if w is not None: gb = QGroupBox(_('Custom metadata'), tab0) gbl = QVBoxLayout() gb.setLayout(gbl) sr = QScrollArea(gb) sr.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) sr.setWidgetResizable(True) sr.setFrameStyle(QFrame.NoFrame) sr.setWidget(w) gbl.addWidget(sr) l.addWidget(gb, 0, 1, 1, 1) sp = QSizePolicy() sp.setVerticalStretch(10) sp.setHorizontalPolicy(QSizePolicy.Minimum) sp.setVerticalPolicy(QSizePolicy.Expanding) gb.setSizePolicy(sp) self.set_custom_metadata_tab_order() # comments span col 0 & 1 w = QGroupBox(_('Comments'), tab0) sp = QSizePolicy() sp.setVerticalStretch(10) sp.setHorizontalPolicy(QSizePolicy.Expanding) sp.setVerticalPolicy(QSizePolicy.Expanding) w.setSizePolicy(sp) lb = QHBoxLayout() w.setLayout(lb) lb.addWidget(self.comments) l.addWidget(w, 1, 0, 1, 2) # Cover & formats in col 3 gb = QGroupBox(_('Cover'), tab0) lb = QGridLayout() gb.setLayout(lb) lb.addWidget(self.cover, 0, 0, 1, 3, alignment=Qt.AlignCenter) sto(self.manage_authors_button, self.cover.buttons[0]) for i, b in enumerate(self.cover.buttons[:3]): lb.addWidget(b, 1, i, 1, 1) sto(b, self.cover.buttons[i + 1]) hl = QHBoxLayout() for b in self.cover.buttons[3:]: hl.addWidget(b) sto(self.cover.buttons[-2], self.cover.buttons[-1]) lb.addLayout(hl, 2, 0, 1, 3) l.addWidget(gb, 0, 2, 1, 1) l.addWidget(self.formats_manager, 1, 2, 1, 1) sto(self.cover.buttons[-1], self.formats_manager) self.formats_manager.formats.setMaximumWidth(10000) self.formats_manager.formats.setIconSize(QSize(32, 32))
def __init__(self): self.getTrainingData() self.imageWidth = 480 self.imageHeight = 360 self.numRetrieval = 9 QMainWindow.__init__(self) self.setMinimumSize(QSize(self.imageWidth + 60, int(self.imageHeight * 1.9))) self.setWindowTitle("ShapeRetrievalEngine") centralWidget = QWidget(self) self.queryImageFileName = None imageWidget=QWidget(centralWidget) imageWidget.setGeometry(30,30,self.imageWidth ,self.imageHeight) #imageWidget.setAutoFillBackground(True) imageWidget.setStyleSheet("background-color:rgb(0,0,0)") self.queryImageLabel = QLabel() imageWidgetLayout = QVBoxLayout(imageWidget) self.queryImageLabel.setAlignment(Qt.AlignCenter) self.queryImageLabel.setText("<font color='white'>Query Image</font>") imageWidgetLayout.addWidget(self.queryImageLabel) browseButton=QPushButton(centralWidget) browseButton.setGeometry(30, self.imageHeight + 40, 60, 30) browseButton.setText("Browse") browseButton.clicked.connect(self.getfile) searchButton=QPushButton(centralWidget) searchButton.setGeometry(90, self.imageHeight + 40, 60, 30) searchButton.setText("Search") searchButton.clicked.connect(self.getResultSet) scrollAreaImageWidgetContents = QWidget(centralWidget) scrollAreaImageWidgetContents.setGeometry(20, self.imageHeight + 90, self.imageWidth + 10, int(self.imageHeight * 0.25) + 90) scrollAreaImageWidget = QtWidgets.QGroupBox('Retrieval Results') reslayout = QtWidgets.QHBoxLayout() self.resultImageLabelList = [] x = 10 y = 10 for i in range(self.numRetrieval): resSingleLayout = QtWidgets.QVBoxLayout() resultWidget = QWidget() resultWidget.setGeometry(x, y, int(self.imageWidth * 0.25), int(self.imageHeight * 0.25)) resultWidget.setFixedSize(QSize(int(self.imageWidth * 0.25), int(self.imageHeight * 0.25))) resultWidget.setStyleSheet("background-color:rgb(0,0,0)") imageLabel = QLabel() imageLabelLayout = QVBoxLayout(resultWidget) imageLabel.setAlignment(Qt.AlignCenter) imageLabel.setText("<font color='white'>None</font>") imageLabelLayout.addWidget(imageLabel) x = x + int(self.imageWidth * 0.25) + 10 resSingleLayout.addWidget(resultWidget) resLabel = QLabel() resLabel.setAlignment(Qt.AlignCenter) resLabel.setText("Image_"+str(i+1)) resSingleLayout.addWidget(resLabel) reslayout.addItem(resSingleLayout) self.resultImageLabelList.append(imageLabel) scrollAreaImageWidget.setLayout(reslayout) scrollAreaImage=QScrollArea() scrollAreaImage.setWidget(scrollAreaImageWidget) scrollAreaImage.setWidgetResizable(False) scrollAreaImage.setFixedHeight(int(self.imageHeight * 0.25) + 80) scrollAreaImage.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn) layout = QVBoxLayout(scrollAreaImageWidgetContents) layout.addWidget(scrollAreaImage) self.setCentralWidget(centralWidget)
def _setup_ui(self): self.setStyleSheet(self._default) shot = state.get('current_shot') self.setWindowTitle(f'Submit [{shot.name}]') layout = make_layout(horizon=False, margin=24, spacing=24) name_layout = make_layout(spacing=24) label = HeaderLabel('Job Name') label.setAlignment(Qt.AlignCenter) name_layout.addWidget(label) name = f'resolve {len(shot.jobs) + 1}' self._text_name = HeaderLineEdit() self._text_name.setAlignment(Qt.AlignRight) self._text_name.setText(name) self._text_name.setPlaceholderText('Submit Job Name') name_layout.addWidget(self._text_name) layout.addLayout(name_layout) # -------------- layout.addWidget(make_split_line()) label = HeaderLabel('Frame Range (seperate by comma, space or dash)') layout.addWidget(label) min_slider_value, max_slider_value = get_slider_range() self._text_frames = HeaderLineEdit() self._text_frames.setAlignment(Qt.AlignCenter) self._text_frames.setText(f'{min_slider_value}-{max_slider_value}') self._text_frames.setPlaceholderText( '1-101 or 1 2 3 or 1,2,3 or 1 3,4,6-9') layout.addWidget(self._text_frames) hlayout = make_layout(horizon=True, margin=0, spacing=24) label = HeaderLabel('Calibration') hlayout.addWidget(label) self._comboBox = CalibrationComboBox() hlayout.addWidget(self._comboBox) layout.addLayout(hlayout) # submit parameter submit_widget = QWidget() submit_control = QVBoxLayout() submit_meta = { 'reference': 1, 'clip_range': 1, 'mesh_reduce_ratio': 0, 'flows': 2 } for parm_name, layer in submit_meta.items(): parm_value = setting.resolve[parm_name] parm_widget = create_submit_parameter_widget( parm_name, parm_value, layer) if isinstance(parm_widget, ShotSubmitContainer): submit_control.addWidget(parm_widget) else: submit_control.addLayout(parm_widget) self._parms.append(parm_widget) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) submit_widget.setLayout(submit_control) scroll.setWidget(submit_widget) layout.addWidget(scroll) buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel self._buttons = QDialogButtonBox(buttons) self._buttons.accepted.connect(self.accept) self._buttons.rejected.connect(self.reject) layout.addWidget(self._buttons) self.setLayout(layout) self.setMinimumSize(580, 710) move_center(self)
def _setup_ui(self): self.setStyleSheet(self._default) shot = state.get('current_shot') job = state.get('current_job') layout = make_layout( horizon=False, margin=24, spacing=24 ) # shot parms if job is None: self.setWindowTitle(f'[{shot.name}] Camera Parameters') if isinstance(shot.camera_parameters, dict): for key, value in shot.camera_parameters.items(): parm_layout = make_layout(spacing=48) name_label = QLabel(f'{key}:') if isinstance(value, float): value = f'{value:.2f}' else: value = str(value) value_label = QLabel(value) parm_layout.addWidget(name_label) parm_layout.addStretch(0) parm_layout.addWidget(value_label) layout.addLayout(parm_layout) # job parms else: self.setWindowTitle(f'[{job.name}] Submit Parameters') submit_widget = QWidget() submit_control = make_layout( horizon=False, spacing=8, margin=24 ) for key, value in job.parameters.items(): widgets = convert_submit_parm_widgets(key, value, 0) for widget in widgets: if isinstance(widget, QLayout): submit_control.addLayout(widget) else: submit_control.addWidget(widget) scroll = QScrollArea() scroll.setWidgetResizable(False) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) submit_widget.setLayout(submit_control) scroll.setWidget(submit_widget) layout.addWidget(scroll) buttons = QDialogButtonBox.Ok self._buttons = QDialogButtonBox(buttons) self._buttons.accepted.connect(self.accept) self._buttons.rejected.connect(self.reject) layout.addWidget(self._buttons) self.setLayout(layout) move_center(self)