| 6 | |
| 7 | class GUIDesign(QWidget): |
| 8 | def __init__(self, opt_engine, win_size=320, |
| 9 | img_size=64, topK=16, model_name='tmp', useAverage=False, shadow=False): |
| 10 | # draw the layout |
| 11 | QWidget.__init__(self) |
| 12 | morph_steps = 16 |
| 13 | self.opt_engine = opt_engine |
| 14 | self.drawWidget = gui_draw.GUIDraw(opt_engine, win_size=win_size, |
| 15 | img_size=img_size, topK=topK, useAverage=useAverage, shadow=shadow) |
| 16 | self.drawWidget.setFixedSize(win_size, win_size) |
| 17 | vbox = QVBoxLayout() |
| 18 | |
| 19 | self.drawWidgetBox = QGroupBox() |
| 20 | self.drawWidgetBox.setTitle('Drawing Pad') |
| 21 | vbox_t = QVBoxLayout() |
| 22 | vbox_t.addWidget(self.drawWidget) |
| 23 | self.drawWidgetBox.setLayout(vbox_t) |
| 24 | vbox.addWidget(self.drawWidgetBox) |
| 25 | self.slider = QSlider(Qt.Horizontal) |
| 26 | vbox.addStretch(1) |
| 27 | self.slider.setMinimum(0) |
| 28 | self.slider.setMaximum(morph_steps-1) |
| 29 | self.slider.setValue(0) |
| 30 | self.slider.setTickPosition(QSlider.TicksBelow) |
| 31 | self.slider.setTickInterval(1) |
| 32 | |
| 33 | vbox.addWidget(self.slider) |
| 34 | vbox.addStretch(1) |
| 35 | self.bColor= QRadioButton("Coloring") |
| 36 | self.bColor.setToolTip('The coloring brush allows the user to change the color of a specific region.') |
| 37 | self.bEdge= QRadioButton("Sketching") |
| 38 | self.bEdge.setToolTip('The sketching brush allows the user to outline the shape or add fine details.') |
| 39 | self.bWarp = QRadioButton("Warping") |
| 40 | self.bWarp.setToolTip('The warping brush allows the user to modify the shape more explicitly.') |
| 41 | if shadow: |
| 42 | self.bEdge.toggle() |
| 43 | self.bColor.setDisabled(True) |
| 44 | self.bWarp.setDisabled(True) |
| 45 | else: |
| 46 | self.bColor.toggle() |
| 47 | bhbox = QHBoxLayout() |
| 48 | bGroup = QButtonGroup(self) |
| 49 | bGroup.addButton(self.bColor) |
| 50 | bGroup.addButton(self.bEdge) |
| 51 | bGroup.addButton(self.bWarp) |
| 52 | bhbox.addWidget(self.bColor) |
| 53 | bhbox.addWidget(self.bEdge) |
| 54 | bhbox.addWidget(self.bWarp) |
| 55 | |
| 56 | self.bEdit = QCheckBox('&Edits') |
| 57 | self.bEdit.setChecked(True) |
| 58 | # self.bAverage = QCheckBox('&AE') |
| 59 | # self.bAverage.setChecked(useAverage) |
| 60 | self.colorPush = QPushButton() # to visualize the selected color |
| 61 | self.colorPush.setFixedWidth(20) |
| 62 | self.colorPush.setFixedHeight(20) |
| 63 | if shadow: |
| 64 | self.colorPush.setStyleSheet("background-color: black") |
| 65 | else: |