def _init_widgets(self): self._linear_viewer = QLinearDisassembly(self.workspace, self, parent=self) self._flow_graph = QDisassemblyGraph(self.workspace, self, parent=self) self._feature_map = QFeatureMap(self, parent=self) self._statusbar = QDisasmStatusBar(self, parent=self) vlayout = QVBoxLayout() vlayout.addWidget(self._feature_map) vlayout.addWidget(self._flow_graph) vlayout.addWidget(self._linear_viewer) vlayout.addWidget(self._statusbar) vlayout.setContentsMargins(0, 0, 0, 0) self._feature_map.setMaximumHeight(25) vlayout.setStretchFactor(self._feature_map, 0) vlayout.setStretchFactor(self._flow_graph, 1) vlayout.setStretchFactor(self._linear_viewer, 1) vlayout.setStretchFactor(self._statusbar, 0) hlayout = QHBoxLayout() hlayout.addLayout(vlayout) self.setLayout(hlayout) self.display_disasm_graph() # self.display_linear_viewer() self.workspace.plugins.instrument_disassembly_view(self)
def setupBotLogin(self): bl = QWidget() bll = QVBoxLayout() bl.setLayout(bll) ## Back button bbw = QWidget() bbwl = QHBoxLayout() bbw.setLayout(bbwl) bb = QPushButton("<- Go Back") bb.setStyleSheet("background-color: #ffffff;") spacer = QWidget() bbwl.addWidget(bb) bbwl.addWidget(spacer) bbwl.setStretchFactor(spacer, 5) bb.clicked.connect(lambda: self.switcher(self.mm)) bb.clicked.connect(lambda: c.setFixedSize(450, 150)) bll.addWidget(bbw) ## Token Login tw = QWidget() twl = QHBoxLayout() tw.setLayout(twl) token = QLineEdit() token.returnPressed.connect(lambda: loop.create_task(self.loginToken(token.text(), True))) token.setStyleSheet("background-color: #ffffff;") tlb = QPushButton("Login") tlb.setStyleSheet("background-color: #ffffff;") tlb.clicked.connect(lambda: loop.create_task(self.loginToken(token.text(), True))) twl.addWidget(QLabel("Token")) twl.addWidget(token) bll.addWidget(tw) bll.addWidget(tlb) # Align everything to top squish = QWidget() bll.addWidget(squish) bll.setStretchFactor(squish, 5) return bl
def __init__(self): super().__init__() l = QVBoxLayout() self.setLayout(l) title = QLabel("Login to BadDiscord") title.setAlignment(Qt.AlignHCenter) title.setStyleSheet("font: 18pt;") l.addWidget(title) self.mm = QWidget() mml = QVBoxLayout() self.mm.setLayout(mml) ul = self.setupUserLogin() bl = self.setupBotLogin() ulb = QPushButton("Login as User") blb = QPushButton("Login as Bot") mml.addWidget(ulb) ulb.setStyleSheet("background-color: #ffffff;") blb.setStyleSheet("background-color: #ffffff;") mml.addWidget(blb) l.addWidget(ul) l.addWidget(bl) l.addWidget(self.mm) ul.hide() bl.hide() self.cwidget = self.mm ulb.clicked.connect(lambda: self.switcher(ul)) ulb.clicked.connect(lambda: c.setFixedSize(450, 350)) blb.clicked.connect(lambda: self.switcher(bl)) blb.clicked.connect(lambda: c.setFixedSize(450, 220)) # Align everything to top squish = QWidget() l.addWidget(squish) l.setStretchFactor(squish, 5) self.show()
class MainFrame(QMainWindow): def __init__(self, parent=None): super(MainFrame, self).__init__(parent) self.initUI() pass def initUI(self): self.setWindowTitle("My Form") self.mainWindowWidget = QWidget(self) self.mainLeftWidget = QWidget(self) self.mainRightWidget = QWidget(self) self.i = 0 self.vlayout_left = QVBoxLayout() self.vlayout_right = QVBoxLayout() self.hlayout_all = QHBoxLayout() showFilePath = QLineEdit(self) self.tools = ToolsWidget(self) # tools.setStyleSheet("background:rgb(0,255,255)") toolBoxTree = QTreeWidget(self) self.canvas = CanvasWidget(self) self.canvas.setText("label") # self.canvas.setStyleSheet("background:rgb(255,0,255)") self.vlayout_left.addWidget(self.tools) self.vlayout_left.addWidget(toolBoxTree) self.vlayout_left.setStretchFactor(self.tools, 1) self.vlayout_left.setStretchFactor(toolBoxTree, 1) self.vlayout_right.addWidget(showFilePath) self.vlayout_right.addWidget(self.canvas) # self.vlayout_right.setStretchFactor(showFilePath,1) # self.vlayout_right.setStretchFactor(showSrcPicture,1) self.mainLeftWidget.setLayout(self.vlayout_left) self.mainRightWidget.setLayout(self.vlayout_right) self.hlayout_all.addWidget(self.mainLeftWidget) self.hlayout_all.addWidget(self.mainRightWidget) self.hlayout_all.setStretchFactor(self.mainLeftWidget, 1) self.hlayout_all.setStretchFactor(self.mainRightWidget, 3) self.mainWindowWidget.setLayout(self.hlayout_all) self.setCentralWidget(self.mainWindowWidget) #菜单 menu = self.menuBar() openMenu = menu.addMenu("&Open") oFAct = QAction("Open File", self) openMenu.addAction(oFAct) testMenu = menu.addMenu("&Test") test1 = QAction("Bezier", self) testMenu.addAction(test1) test2 = QAction("test2", self) testMenu.addAction(test2) toolMenu = menu.addMenu("&Tools") penTool = QAction("Pen", self) toolMenu.addAction(penTool) scissorTool = QAction("Scissor", self) toolMenu.addAction(scissorTool) # 连接槽函数 # self.tools.generate_contour.clicked.connect(self.generateContour) self.tools.generate_contour.clicked.connect(self.b1Click) self.tools.b2.clicked.connect(self.b2Click) self.tools.b3.clicked.connect(self.b3Click) self.tools.b4.clicked.connect(self.b4Click) # 打开文件 oFAct.triggered.connect(self.onOpenFile) test1.triggered.connect(self.test1) test2.triggered.connect(self.test2) penTool.triggered.connect(self.penToolClick) scissorTool.triggered.connect(self.scissorTool) pass def generateContour(self): print("begin generate contour") if len(self.canvas.img) <= 0: print("the pictuer empty") else: e = self.tools.contour_epsilon.value() #转灰度图 gray = cv2.cvtColor(self.canvas.img, cv2.COLOR_BGR2GRAY) #ret 边界阈值,binary输出数组 ret, binary = cv2.threshold(gray, 15, 255, cv2.THRESH_BINARY) contours, hierarchy = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) self.canvas.has_contour = True for con in contours: contour = cv2.approxPolyDP(con, e, True) self.canvas.contours.append(contour) self.canvas.update() pass def b1Click(self): print("b1") # self.canvas.state=2 self.canvas.update() pass def b2Click(self): print("b2") self.canvas.update() pass def b3Click(self): print("b3") canvas = self.canvas item = ItemImage(canvas.backView, 0, 0) item.width = canvas.opeView.width() item.height = canvas.opeView.height() canvas.drawItemList["images"].append(item) self.canvas.update() pass def b4Click(self): print("save") canvas = self.canvas canvas.qp.begin(self.canvas.backView) canvas.qp.drawImage(canvas.backView.rect(), canvas.opeView) canvas.qp.end() pass def penToolClick(self): self.canvas.toolState = 1 self.canvas.state = 0 pass def scissorTool(self): if self.canvas.toolState == 2: return self.canvas.toolState = 2 self.canvas.state = 0 self.canvas.scissorLogic = scissorLogic(scissor(self.canvas.img)) find = False for item in self.canvas.drawItemList["lines"]: # 当前列表中有且只有两个item,id为SICISSOR if item.id | DrawItem.ID_SCISSOR != 0: find = True item.xs = [] item.ys = [] break if not find: itemStaticList = DrawItem.ItemCurve([], []) itemStaticList.pen = QPen(Qt.green, 1) itemStaticList.width = self.canvas.img.shape[1] itemStaticList.height = self.canvas.img.shape[0] itemStaticList.id = DrawItem.ID_SCISSOR | DrawItem.ID_STATIC itemDynamicList = DrawItem.ItemCurve([], []) itemDynamicList.pen = QPen(Qt.green, 1) itemDynamicList.width = self.canvas.img.shape[1] itemDynamicList.height = self.canvas.img.shape[0] itemDynamicList.id = DrawItem.ID_SCISSOR self.canvas.drawItemList["lines"].append(itemStaticList) self.canvas.drawItemList["lines"].append(itemDynamicList) pass def onOpenFile(self): print("open file") file = QFileDialog() file.exec_() def test1(self): print("test1") canvas = self.canvas canvas.makeCurve = True def test2(self): # print("test2") # canvas=self.canvas # points=canvas.drawItemList[-1]["points"] # x_b,y_b=bezier_curve([x[0] for x in points],[x[1] for x in points],10) # item={} # item["name"]="curve" # item["points"]=[] # item["pen"]=QPen(Qt.blue,3) # item["id"]=1 # item["closed"]=canvas.drawItemList[-1]["closed"] # for i in range(len(x_b)): # item["points"].append((x_b[i],y_b[i])) # item['width']=canvas.width() # item['height']=canvas.height() # canvas.drawItemList.append(item) # self.update() pass pass
def setupUserLogin(self): ul = QWidget() ull = QVBoxLayout() ul.setLayout(ull) ## Back button bbw = QWidget() bbwl = QHBoxLayout() bbw.setLayout(bbwl) bb = QPushButton("<- Go Back") bb.setStyleSheet("background-color: #ffffff;") spacer = QWidget() bbwl.addWidget(bb) bbwl.addWidget(spacer) bbwl.setStretchFactor(spacer, 5) bb.clicked.connect(lambda: self.switcher(self.mm)) bb.clicked.connect(lambda: c.setFixedSize(450, 150)) ull.addWidget(bbw) ## Detail Fields ew = QWidget() pw = QWidget() ewl = QHBoxLayout() pwl = QHBoxLayout() ew.setLayout(ewl) pw.setLayout(pwl) ewl.addWidget(QLabel("Email")) pwl.addWidget(QLabel("Password")) email = QLineEdit() email.setStyleSheet("background-color: #ffffff;") passw = QLineEdit() passw.setEchoMode(QLineEdit.Password) passw.returnPressed.connect(lambda: loop.create_task(self.loginUserDetails(email.text(), passw.text()))) passw.setStyleSheet("background-color: #ffffff;") dlb = QPushButton("Login") dlb.setStyleSheet("background-color: #ffffff;") dlb.clicked.connect(lambda: loop.create_task(self.loginUserDetails(email.text(), passw.text()))) ewl.addWidget(email) pwl.addWidget(passw) ull.addWidget(ew) ull.addWidget(pw) ull.addWidget(dlb) ## Seperator ull.addWidget(QLabel("_______________________________________________________________________")) ## Token Login tw = QWidget() twl = QHBoxLayout() tw.setLayout(twl) token = QLineEdit() token.returnPressed.connect(lambda: loop.create_task(self.loginToken(token.text(), False))) token.setStyleSheet("background-color: #ffffff;") tlb = QPushButton("Login") tlb.setStyleSheet("background-color: #ffffff;") tlb.clicked.connect(lambda: loop.create_task(self.loginToken(token.text(), False))) twl.addWidget(QLabel("Token")) twl.addWidget(token) ull.addWidget(tw) ull.addWidget(tlb) # Align everything to top squish = QWidget() ull.addWidget(squish) ull.setStretchFactor(squish, 100) return ul
class MainWidget(QWidget): def __init__(self): QWidget.__init__(self) #self.grabKeyboard() def initialize(self): self.spinsystems_widget = SpinSystems() self.spinsystems_widget.main_widget = self # set up main layout self.mainLayout() def mainLayout(self): self.main_layout = QHBoxLayout() self.left_layout = QVBoxLayout() self.main_layout.addLayout(self.left_layout) self.main_layout.setStretchFactor(self.left_layout, 2) self.setLayout(self.main_layout) self.dropdownmenu() self.structure_disp = QSvgWidget() self.csbox = QLabel() self.spinsystems_widget.displayspinsystem(self.spinsystem_menu.currentText()) self.left_layout.addWidget(self.csbox) self.left_layout.addWidget(self.structure_disp) self.motif_builder = QPushButton('Build Motifs') def buildmotifs(): self.spinsystems_widget.motifbuilder(self.spinsystem_menu.currentText()) self.motif_builder.clicked.connect(buildmotifs) self.left_layout.addWidget(self.motif_builder) self.map_pathways = QPushButton('Map Pathways') def mappathways(): self.spinsystems_widget.pathwaysearch(self.spinsystem_menu.currentText()) self.spinsystems_widget.showpathwaylist() self.map_pathways.clicked.connect(mappathways) self.left_layout.addWidget(self.map_pathways) self.structureoptions() self.speciesmenu() self.builtmotiflayout = QVBoxLayout() self.builtmotiflist = QListWidget() self.builtmotiflayout.addWidget(self.builtmotiflist) self.builtmotiflayout.setStretchFactor(self.builtmotiflist, 9) self.builtmotifcount = QLabel('Count: ') self.builtmotiflayout.addWidget(self.builtmotifcount) self.builtmotiflayout.setStretchFactor(self.builtmotifcount, 1) self.main_layout.addLayout(self.builtmotiflayout) self.main_layout.setStretchFactor(self.builtmotiflayout, 4) self.pathwaylistlayout = QVBoxLayout() self.pathwaylist = QListWidget() self.pathwaylistlayout.addWidget(self.pathwaylist) self.pathwaylistlayout.setStretchFactor(self.pathwaylist, 9) self.pathwaycount = QLabel('Count: ') self.pathwaylistlayout.addWidget(self.pathwaycount) self.pathwaylistlayout.setStretchFactor(self.pathwaycount, 1) self.main_layout.addLayout(self.pathwaylistlayout) self.main_layout.setStretchFactor(self.pathwaylistlayout, 4) self.processlist = QListWidget() #self.main_layout.addWidget(self.processlist) self.processcount = QLabel('Count: ') #self.main_layout.addWidget(self.processcount) def dropdownmenu(self): self.spinsystem_menu = QComboBox() self.spinsystem_menu.addItems(list(self.spinsystems_widget.spinsystems.keys())) self.left_layout.addWidget(self.spinsystem_menu) def on_currentIndexChanged(): self.spinsystems_widget.built_motifs = {} self.builtmotiflist.clear() self.builtmotifcount.setText('Count: ') self.pathwaylist.clear() self.pathwaycount.setText('Count: ') self.spinsystems_widget.displayspinsystem(self.spinsystem_menu.currentText()) self.spinsystem_menu.currentIndexChanged.connect(on_currentIndexChanged) def structureoptions(self): self.structure_menu = {'layout': QVBoxLayout()} text = {'metabolites': 'Metabolites', 'motif_0': 'Motif_0', 'motif_1': 'Motif_1', 'motif_2': 'Motif_2', 'submotif_1': 'Sub-Motif_1', 'submotif_2': 'Sub-Motif_2', 'submotif_3': 'Sub-Motif_3', 'submotif_4': 'Sub-Motif_4'} for opt in ['metabolites', 'motif_0', 'motif_1', 'motif_2', 'submotif_1', 'submotif_2', 'submotif_3', 'submotif_4']: self.structure_menu[opt] = QCheckBox(text[opt]) self.structure_menu[opt].setChecked(True) self.structure_menu['layout'].addWidget(self.structure_menu[opt]) self.left_layout.addLayout(self.structure_menu['layout']) def speciesmenu(self): self.species_menu = QComboBox() specieslist = self.spinsystems_widget.pathwaymapper.Reactome.specieslist specieslist.remove('H**o sapiens') specieslist = ['H**o sapiens']+sorted(specieslist, key=lambda x: x) print(''.join(['<option value = "'+s+'">'+s+'</option>' for s in specieslist])) self.species_menu.addItems(specieslist) self.left_layout.addWidget(self.species_menu)
def __init__(self, glwidget: QtWidgets.QOpenGLWidget, parent=None, ): super().__init__(parent) # OpenGL Widget self.glLayout = QVBoxLayout() self.glLabel = QLabel("OpenGL Widget") self.glWidget = glwidget() self.glLayout.addWidget(self.glLabel) self.glLayout.addWidget(self.glWidget) self.glLayout.setStretchFactor(self.glWidget, 1) self.glSection = QWidget() self.glSection.setLayout(self.glLayout) # Cube Controls self.labelx = QLabel("x") self.labely = QLabel("y") self.labelz = QLabel("z") self.xSlider = createSlider() self.ySlider = createSlider() self.zSlider = createSlider() # sliderLayoutV1 = QVBoxLayout() sliderLayoutV1.addWidget(self.labelx) sliderLayoutV1.addWidget(self.xSlider) # sliderLayoutV2 = QVBoxLayout() sliderLayoutV2.addWidget(self.labely) sliderLayoutV2.addWidget(self.ySlider) # sliderLayoutV3 = QVBoxLayout() sliderLayoutV3.addWidget(self.labelz) sliderLayoutV3.addWidget(self.zSlider) # sliderSection = QVBoxLayout() slidersLayout = QHBoxLayout() slidersTitle = QLabel('Rotate cubes') slidersLayout.addLayout(sliderLayoutV1) slidersLayout.addLayout(sliderLayoutV2) slidersLayout.addLayout(sliderLayoutV3) sliderSection.addWidget(slidersTitle) sliderSection.addLayout(slidersLayout) slidersWidget = QWidget() slidersWidget.setLayout(sliderSection) # Camera Controls # Rotate camera self.camX = createSlider() self.camY = createSlider() self.camX.setRange(-180, 180) self.camY.setRange(-180, 180) self.camX.setValue(0) self.camY.setValue(0) self.camlabelx = QLabel("x") self.camlabely = QLabel("y") self.camlabel = QLabel("Rotate camera") camV1 = QVBoxLayout() camV2 = QVBoxLayout() camV1.addWidget(self.camlabelx) camV1.addWidget(self.camX) camV2.addWidget(self.camlabely) camV2.addWidget(self.camY) cams = QHBoxLayout() cams.addLayout(camV1) cams.addLayout(camV2) camsWidget = QWidget() camsWidget.setLayout(cams) # cube and cam sliders camSection = QVBoxLayout() camSection.addWidget(self.camlabel) camSection.addWidget(camsWidget) camSection.setStretchFactor(camsWidget, 1) camSecWidget = QWidget() camSecWidget.setLayout(camSection) # camsCubes = QHBoxLayout() camsCubes.addWidget(slidersWidget) camsCubes.addWidget(camSecWidget) # buttonsTitel = QLabel("Move camera") buttonsLayoutH1 = QHBoxLayout() buttonsLayoutH2 = QHBoxLayout() buttonsLayoutV = QVBoxLayout() self.leftBtn = QtWidgets.QPushButton() self.rightBtn = QtWidgets.QPushButton() self.upBtn = QtWidgets.QPushButton() self.downBtn = QtWidgets.QPushButton() buttonsLayoutH1.addWidget(self.upBtn) buttonsLayoutH2.addWidget(self.leftBtn) buttonsLayoutH2.addWidget(self.downBtn) buttonsLayoutH2.addWidget(self.rightBtn) buttonsLayoutV.addWidget(buttonsTitel) buttonsLayoutV.addLayout(buttonsLayoutH1) buttonsLayoutV.addLayout(buttonsLayoutH2) buttonsLayoutV.addLayout(camsCubes) buttonsWidget = QWidget() buttonsWidget.setLayout(buttonsLayoutV) # self.leftBtn.setText("<") self.rightBtn.setText(">") self.upBtn.setText("^") self.downBtn.setText("v") self.leftBtn.setAutoRepeat(True) self.leftBtn.setAutoRepeatInterval(15) # repeat at x milisecond self.leftBtn.setAutoRepeatDelay(100) # start repeating after # x milisecond self.rightBtn.setAutoRepeat(True) self.rightBtn.setAutoRepeatDelay(100) self.rightBtn.setAutoRepeatInterval(15) # self.downBtn.setAutoRepeat(True) self.downBtn.setAutoRepeatDelay(100) self.downBtn.setAutoRepeatInterval(15) # self.upBtn.setAutoRepeat(True) self.upBtn.setAutoRepeatDelay(100) self.upBtn.setAutoRepeatInterval(15) # # Light controls # lightSection = QWidget() lightSectionLayout = QVBoxLayout() lightSectionLabel = QLabel("Light Controls") lightSectionWidgetsLayout = QVBoxLayout() # slidersLayout = QHBoxLayout() # light position self.lightPosWidget = QWidget() self.lightPosTitle = QLabel("light position") self.lightPosLayout = QVBoxLayout() lightPosWidgetsLayout = QHBoxLayout() # # light pos buttons self.lightPosForward = QPushButton() self.lightPosForward.setText("Forward") self.lightPosForward.setAutoRepeat(True) self.lightPosForward.setAutoRepeatInterval(15) self.lightPosForward.setAutoRepeatDelay(100) self.lightPosBackward = QPushButton() self.lightPosBackward.setText("Back") self.lightPosBackward.setAutoRepeat(True) self.lightPosBackward.setAutoRepeatInterval(15) self.lightPosBackward.setAutoRepeatDelay(100) self.lightPosRight = QPushButton() self.lightPosRight.setText("Right") self.lightPosRight.setAutoRepeat(True) self.lightPosRight.setAutoRepeatInterval(15) self.lightPosRight.setAutoRepeatDelay(100) self.lightPosLeft = QPushButton() self.lightPosLeft.setText("Left") self.lightPosLeft.setAutoRepeat(True) self.lightPosLeft.setAutoRepeatDelay(100) self.lightPosLeft.setAutoRepeatInterval(15) self.lightPosUp = QPushButton() self.lightPosUp.setText("Up") self.lightPosUp.setAutoRepeat(True) self.lightPosUp.setAutoRepeatDelay(100) self.lightPosUp.setAutoRepeatInterval(15) self.lightPosDown = QPushButton() self.lightPosDown.setText("Down") self.lightPosDown.setAutoRepeat(True) self.lightPosDown.setAutoRepeatDelay(100) self.lightPosDown.setAutoRepeatInterval(15) btnLV = QVBoxLayout() btnLV2 = QVBoxLayout() btnLH = QHBoxLayout() btnLV2.addWidget(self.lightPosForward) btnLV2.addWidget(self.lightPosBackward) btnLV.addWidget(self.lightPosUp) btnLV.addWidget(self.lightPosDown) btnLH.addWidget(self.lightPosLeft) btnLH.addLayout(btnLV2) btnLH.addLayout(btnLV) btnLH.addWidget(self.lightPosRight) # lightPosWidgetsLayout.addLayout(btnLH) self.lightPosLayout.addWidget(self.lightPosTitle) self.lightPosLayout.addLayout(lightPosWidgetsLayout) self.lightPosWidget.setLayout(self.lightPosLayout) slidersLayout.addWidget(self.lightPosWidget) # end light position # light rotation self.lightRotWidget = QWidget() self.lightRotTitle = QLabel("light rotation") self.lightRotLayout = QVBoxLayout() lightRotWidgetsLayout = QHBoxLayout() # self.lightRotXSlider = createSlider() self.lightRotXSlider.setRange(-180, 180) self.lightRotXSlider.setValue(0) self.lightRotXTitle = QLabel("x") RotxLayout = QVBoxLayout() RotxLayout.addWidget(self.lightRotXTitle) RotxLayout.addWidget(self.lightRotXSlider) # self.lightRotYSlider = createSlider() self.lightRotYSlider.setRange(-180, 180) self.lightRotYSlider.setValue(0) self.lightRotYTitle = QLabel("y") RotyLayout = QVBoxLayout() RotyLayout.addWidget(self.lightRotYTitle) RotyLayout.addWidget(self.lightRotYSlider) # self.lightRotZSlider = createSlider() self.lightRotZSlider.setRange(-180, 180) self.lightRotZSlider.setValue(0) self.lightRotZTitle = QLabel("z") RotzLayout = QVBoxLayout() RotzLayout.addWidget(self.lightRotZTitle) RotzLayout.addWidget(self.lightRotZSlider) # lightRotWidgetsLayout.addLayout(RotxLayout) lightRotWidgetsLayout.addLayout(RotyLayout) lightRotWidgetsLayout.addLayout(RotzLayout) # self.lightRotLayout.addWidget(self.lightRotTitle) self.lightRotLayout.addLayout(lightRotWidgetsLayout) self.lightRotWidget.setLayout(self.lightRotLayout) slidersLayout.addWidget(self.lightRotWidget) # end light rotation # spinsLayout = QVBoxLayout() # lightTypesLayout = QVBoxLayout() adsLayout = QHBoxLayout() # ambient light ambientWidget = QWidget() ambientLayout = QVBoxLayout() ambientTitle = QLabel("ambient") ambientWidgetsLayout = QVBoxLayout() # ambient red self.ambientIntensityRed = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.ambientIntensityRedCoeff = createDSpinBox(0.0, 1.0, 0.05, 0.3) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.ambientIntensityRed) intenCoeff.addWidget(self.ambientIntensityRedCoeff) self.ambientRedLabel = QLabel("Red") channelLayout = QVBoxLayout() channelLayout.addWidget(self.ambientRedLabel) channelLayout.addLayout(intenCoeff) ambientWidgetsLayout.addLayout(channelLayout) # end ambient red # ambient green self.ambientIntensityGreen = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.ambientIntensityGreenCoeff = createDSpinBox(0.0, 1.0, 0.05, 0.3) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.ambientIntensityGreen) intenCoeff.addWidget(self.ambientIntensityGreenCoeff) self.ambientGreenLabel = QLabel("Green") channelLayout = QVBoxLayout() channelLayout.addWidget(self.ambientGreenLabel) channelLayout.addLayout(intenCoeff) ambientWidgetsLayout.addLayout(channelLayout) # end ambient green # ambient blue self.ambientIntensityBlue = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.ambientIntensityBlueCoeff = createDSpinBox(0.0, 1.0, 0.05, 0.3) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.ambientIntensityBlue) intenCoeff.addWidget(self.ambientIntensityBlueCoeff) self.ambientBlueLabel = QLabel("Blue") channelLayout = QVBoxLayout() channelLayout.addWidget(self.ambientBlueLabel) channelLayout.addLayout(intenCoeff) # end ambient blue ambientWidgetsLayout.addLayout(channelLayout) ambientLayout.addWidget(ambientTitle) ambientLayout.addLayout(ambientWidgetsLayout) ambientWidget.setLayout(ambientLayout) # adsLayout.addWidget(ambientWidget) # end ambient light # diffuse light diffuseWidget = QWidget() diffuseLayout = QVBoxLayout() diffuseTitle = QLabel("diffuse") diffuseWidgetsLayout = QVBoxLayout() # diffuse red self.diffuseIntensityRed = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.diffuseIntensityRedCoeff = createDSpinBox(0.0, 1.0, 0.05) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.diffuseIntensityRed) intenCoeff.addWidget(self.diffuseIntensityRedCoeff) self.diffuseRedLabel = QLabel("Red") channelLayout = QVBoxLayout() channelLayout.addWidget(self.diffuseRedLabel) channelLayout.addLayout(intenCoeff) diffuseWidgetsLayout.addLayout(channelLayout) # end diffuse red # diffuse green self.diffuseIntensityGreen = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.diffuseIntensityGreenCoeff = createDSpinBox(0.0, 1.0, 0.05, 0.5) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.diffuseIntensityGreen) intenCoeff.addWidget(self.diffuseIntensityGreenCoeff) self.diffuseGreenLabel = QLabel("Green") channelLayout = QVBoxLayout() channelLayout.addWidget(self.diffuseGreenLabel) channelLayout.addLayout(intenCoeff) diffuseWidgetsLayout.addLayout(channelLayout) # end diffuse green # diffuse blue self.diffuseIntensityBlue = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.diffuseIntensityBlueCoeff = createDSpinBox(0.0, 1.0, 0.05, 0.5) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.diffuseIntensityBlue) intenCoeff.addWidget(self.diffuseIntensityBlueCoeff) self.diffuseBlueLabel = QLabel("Blue") channelLayout = QVBoxLayout() channelLayout.addWidget(self.diffuseBlueLabel) channelLayout.addLayout(intenCoeff) # end diffuse blue diffuseWidgetsLayout.addLayout(channelLayout) diffuseLayout.addWidget(diffuseTitle) diffuseLayout.addLayout(diffuseWidgetsLayout) diffuseWidget.setLayout(diffuseLayout) # adsLayout.addWidget(diffuseWidget) # end diffuse light # specular light specularWidget = QWidget() specularLayout = QVBoxLayout() specularTitle = QLabel("specular") specularWidgetsLayout = QVBoxLayout() # specular red self.specularIntensityRed = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.specularIntensityRedCoeff = createDSpinBox(0.0, 1.0, 0.05, 1.0) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.specularIntensityRed) intenCoeff.addWidget(self.specularIntensityRedCoeff) self.specularRedLabel = QLabel("Red") channelLayout = QVBoxLayout() channelLayout.addWidget(self.specularRedLabel) channelLayout.addLayout(intenCoeff) specularWidgetsLayout.addLayout(channelLayout) # end specular red # specular green self.specularIntensityGreen = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.specularIntensityGreenCoeff = createDSpinBox(0.0, 1.0, 0.05, 1.0) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.specularIntensityGreen) intenCoeff.addWidget(self.specularIntensityGreenCoeff) self.specularGreenLabel = QLabel("Green") channelLayout = QVBoxLayout() channelLayout.addWidget(self.specularGreenLabel) channelLayout.addLayout(intenCoeff) specularWidgetsLayout.addLayout(channelLayout) # end specular green # specular blue self.specularIntensityBlue = createDSpinBox(0.0, 1.0, 0.01, 1.0) self.specularIntensityBlueCoeff = createDSpinBox(0.0, 1.0, 0.05, 1.0) intenCoeff = QHBoxLayout() intenCoeff.addWidget(self.specularIntensityBlue) intenCoeff.addWidget(self.specularIntensityBlueCoeff) self.specularBlueLabel = QLabel("Blue") channelLayout = QVBoxLayout() channelLayout.addWidget(self.specularBlueLabel) channelLayout.addLayout(intenCoeff) # end specular blue specularWidgetsLayout.addLayout(channelLayout) specularLayout.addWidget(specularTitle) specularLayout.addLayout(specularWidgetsLayout) specularWidget.setLayout(specularLayout) # adsLayout.addWidget(specularWidget) spinsLayout.addLayout(adsLayout) # end specular light # attenuation attenuationWidget = QWidget() attenuationLayout = QVBoxLayout() attenuationTitle = QLabel("attenuation") attenuationWidgetsLayout = QHBoxLayout() # constant attenuation self.attenConstant = createDSpinBox(0.1, 1.0, 0.1) self.attenConstant.setValue(1.0) self.attenConstLabel = QLabel("constant") attenConstV = QVBoxLayout() attenConstV.addWidget(self.attenConstLabel) attenConstV.addWidget(self.attenConstant) attenuationWidgetsLayout.addLayout(attenConstV) # linear attenuation self.attenLinear = createDSpinBox(0.001, 10.0, 0.1, 0.7) self.attenLinearLabel = QLabel("linear") attenLinearV = QVBoxLayout() attenLinearV.addWidget(self.attenLinearLabel) attenLinearV.addWidget(self.attenLinear) attenuationWidgetsLayout.addLayout(attenLinearV) # quadratic attenuation self.attenQuadratic = createDSpinBox(0.001, 10.0, 1.8) self.attenQuadraticLabel = QLabel("quadratic") attenQuadraticV = QVBoxLayout() attenQuadraticV.addWidget(self.attenQuadraticLabel) attenQuadraticV.addWidget(self.attenQuadratic) attenuationWidgetsLayout.addLayout(attenQuadraticV) # attenuationLayout.addWidget(attenuationTitle) attenuationLayout.addLayout(attenuationWidgetsLayout) attenuationWidget.setLayout(attenuationLayout) # spinsLayout.addWidget(attenuationWidget) # end attenuation # angle and shininess otherWidget = QWidget() otherLayout = QHBoxLayout() # angle angLayout = QVBoxLayout() anglbl = QLabel("angle") self.angleSpin = createDSpinBox(1.0, 90.0, 1.0, 30.0) angLayout.addWidget(anglbl) angLayout.addWidget(self.angleSpin) # otherLayout.addLayout(angLayout) # end angle # shininess shinLayout = QVBoxLayout() shinlbl = QLabel("shininess") self.shininessSpin = createDSpinBox(0.01, 250.0, 0.01, 20.0) shinLayout.addWidget(shinlbl) shinLayout.addWidget(self.shininessSpin) # otherLayout.addLayout(shinLayout) # end shininess # cut off cutOffTitle = QLabel("Cut Off") cutOffLayout = QVBoxLayout() self.cutOffSpin = createDSpinBox(0.1, 520.0, 0.1) cutOffLayout.addWidget(cutOffTitle) cutOffLayout.addWidget(self.cutOffSpin) # otherLayout.addLayout(cutOffLayout) # end cut off otherWidget.setLayout(otherLayout) spinsLayout.addWidget(otherWidget) # end other widgets lightSectionWidgetsLayout.addLayout(spinsLayout) lightSectionWidgetsLayout.addLayout(slidersLayout) # lightSectionLayout.addWidget(lightSectionLabel) lightSectionLayout.addLayout(lightSectionWidgetsLayout) lightSection.setLayout(lightSectionLayout) # end light controls # mainLayout = QHBoxLayout() mainLayout.addWidget(self.glSection) mainLayout.addWidget(buttonsWidget) mainLayout.addWidget(lightSection) mainLayout.setStretchFactor(self.glSection, 1) self.mainwidget = QWidget() self.mainwidget.setLayout(mainLayout) self.setCentralWidget(self.mainwidget) self.setWindowTitle("PySide2 OpenGL Test Window") self.setMinimumSize(800, 600)