def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # --Layout Stuff---------------------------# mainLayout = QtGui.QVBoxLayout() layout = QtGui.QHBoxLayout() self.label = QtGui.QLabel() self.label.setText("port") layout.addWidget(self.label) self.text = QtGui.QLineEdit("10001") layout.addWidget(self.text) self.ip = QtGui.QLabel() self.ip.setText("host") layout.addWidget(self.ip) self.text_ip = QtGui.QLineEdit("0.0.0.0") layout.addWidget(self.text_ip) mainLayout.addLayout(layout) # --The Button------------------------------# layout = QtGui.QHBoxLayout() button = QtGui.QPushButton("okay") # string or icon self.connect(button, QtCore.SIGNAL("clicked()"), self.close) layout.addWidget(button) mainLayout.addLayout(layout) self.setLayout(mainLayout) self.resize(250, 100) self.setWindowTitle("SyConnGate Settings")
def __init__(self): self.widget = QtGui.QGroupBox('Drill Planner') self.deltaSpinBoxes = [QtGui.QSpinBox() for i in xrange(3)] for spin in self.deltaSpinBoxes: spin.setMinimum(-100) spin.setMaximum(100) spin.setSingleStep(1) l = QtGui.QVBoxLayout(self.widget) l.addWidget(_makeButton('refit drill', self.refitDrill)) l.addWidget(_makeButton('button preset posture', self.gotoButtonPreset)) l.addWidget(_makeButton('button pre-pose plan', self.buttonPrePosePlan)) l.addWidget(_makeButton('request nominal plan', self.nominalPlan)) l.addWidget( _makeButton('request arm prepose plan', self.armPreposePlan)) l.addWidget(_makeButton('request walking goal', self.walkingGoal)) l.addWidget( _makeButton('request nominal fixed plan', self.nominalFixedPlan)) l.addWidget(_makeButton('request pre-drill plan', self.preDrillPlan)) l.addWidget(_makeButton('request drill-in plan', self.drillInPlan)) l.addWidget(QtGui.QLabel('')) l.addWidget(_makeButton('next drill plan', self.nextDrillPlan)) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.addWidget(_makeButton('set drill depth', self.setDrillDepth)) self.drillDepthSpin = QtGui.QSpinBox() self.drillDepthSpin.setMinimum(-100) self.drillDepthSpin.setMaximum(100) self.drillDepthSpin.setSingleStep(1) hl.addWidget(self.drillDepthSpin) hl.addWidget(QtGui.QLabel('cm')) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) self.drillDeltaCombo = QtGui.QComboBox() self.drillDeltaCombo.addItem('button') self.drillDeltaCombo.addItem('wall') self.drillDeltaButton = _makeButton('drill delta', self.drillDelta) hl.addWidget(self.drillDeltaButton) hl.addWidget(self.drillDeltaCombo) for spin in self.deltaSpinBoxes: hl.addWidget(spin) hl.addWidget(QtGui.QLabel('cm')) hl.addWidget(_makeButton('clear', self.clearDrillDelta)) l.addWidget(QtGui.QLabel('')) l.addWidget(QtGui.QLabel('')) l.addWidget(hw) self.keyPressNav = KeyboardNavigation() self.keyPressNav.callbacks.append(self.onKeyPress) l.addWidget(self.keyPressNav.widget)
def _makeValveWizard(self): wizard = QtGui.QWidget() l = QtGui.QVBoxLayout(wizard) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.valveMethodCombo = QtGui.QComboBox() self.valveMethodCombo.addItem('auto wall') self.valveMethodCombo.addItem('manual') hl.addWidget(QtGui.QLabel('method:')) hl.addWidget(self.valveMethodCombo) l.addWidget(hw) l.addWidget(_makeButton('segment large valve', self.segmentLargeValve)) l.addWidget(_makeButton('segment small valve', self.segmentSmallValve)) l.addWidget(_makeButton('segment bar', self.segmentLeverValve)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('segment value radius:', self.segmentValveCustomRadius)) self.valveRadiusSpin = QtGui.QSpinBox() self.valveRadiusSpin.setMinimum(0) self.valveRadiusSpin.setMaximum(99) self.valveRadiusSpin.setSingleStep(1) hl.addWidget(self.valveRadiusSpin) hl.addWidget(QtGui.QLabel('cm')) l.addWidget(hw) l.addWidget(QtGui.QLabel('')) l.addWidget(_makeButton('refit wall', startRefitWall)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('request valve circle plan', self.requestValveCirclePlan)) self.circlePlanAngle = QtGui.QSpinBox() self.circlePlanAngle.setMinimum(-360) self.circlePlanAngle.setMaximum(360) self.circlePlanAngle.setSingleStep(5) hl.addWidget(self.circlePlanAngle) hl.addWidget(QtGui.QLabel('degrees')) l.addWidget(hw) l.addStretch() return wizard
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.aborted = False # --Layout Stuff---------------------------# mainLayout = QtGui.QVBoxLayout() layout = QtGui.QHBoxLayout() self.label = QtGui.QLabel() self.label.setText("port") layout.addWidget(self.label) self.text = QtGui.QLineEdit("10001") layout.addWidget(self.text) self.ip = QtGui.QLabel() self.ip.setText("host") layout.addWidget(self.ip) self.text_ip = QtGui.QLineEdit("localhost") layout.addWidget(self.text_ip) mainLayout.addLayout(layout) layout = QtGui.QHBoxLayout() self.synapse_tresh = QtGui.QLabel() self.synapse_tresh.setText("Syn. prob. thresh.") layout.addWidget(self.synapse_tresh) self.text_synthresh = QtGui.QLineEdit("0.6") layout.addWidget(self.text_synthresh) self.axodend_button = QtGui.QPushButton("Axo-dendr. syn. only") self.axodend_button.setCheckable(True) self.axodend_button.toggle() layout.addWidget(self.axodend_button) mainLayout.addLayout(layout) # --The Button------------------------------# layout = QtGui.QHBoxLayout() button = QtGui.QPushButton("connect") # string or icon self.connect(button, QtCore.SIGNAL("clicked()"), self.close) layout.addWidget(button) button = QtGui.QPushButton("abort") # string or icon self.connect(button, QtCore.SIGNAL("clicked()"), self.abort_button_clicked) layout.addWidget(button) mainLayout.addLayout(layout) self.setLayout(mainLayout) self.resize(450, 300) self.setWindowTitle("SyConnGate Settings")
def _makeValveWizard(self): wizard = QtGui.QWidget() l = QtGui.QVBoxLayout(wizard) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.valveMethodCombo = QtGui.QComboBox() self.valveMethodCombo.addItem("auto wall") self.valveMethodCombo.addItem("manual") hl.addWidget(QtGui.QLabel("method:")) hl.addWidget(self.valveMethodCombo) l.addWidget(hw) l.addWidget(_makeButton("segment large valve", self.segmentLargeValve)) l.addWidget(_makeButton("segment small valve", self.segmentSmallValve)) l.addWidget(_makeButton("segment bar", self.segmentLeverValve)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton("segment value radius:", self.segmentValveCustomRadius)) self.valveRadiusSpin = QtGui.QSpinBox() self.valveRadiusSpin.setMinimum(0) self.valveRadiusSpin.setMaximum(99) self.valveRadiusSpin.setSingleStep(1) hl.addWidget(self.valveRadiusSpin) hl.addWidget(QtGui.QLabel("cm")) l.addWidget(hw) l.addWidget(QtGui.QLabel("")) l.addWidget(_makeButton("refit wall", startRefitWall)) hw = QtGui.QFrame() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.circlePlanAngle = QtGui.QSpinBox() self.circlePlanAngle.setMinimum(-360) self.circlePlanAngle.setMaximum(360) self.circlePlanAngle.setSingleStep(5) hl.addWidget(self.circlePlanAngle) hl.addWidget(QtGui.QLabel("degrees")) l.addWidget(hw) l.addStretch() return wizard
def wrapInHTitledItem(name, items): box = QtGui.QGroupBox(name) box.setAlignment(QtCore.Qt.AlignCenter) boxLayout = QtGui.QHBoxLayout(box) for item in items: boxLayout.addWidget(item) return box
def __init__ (self, parent): super(_StepByStepSolverTab, self).__init__ (parent) self.plugin = parent box = QtGui.QVBoxLayout(self) b = QtGui.QPushButton(self) b.text = "Initialize step by step sequence" box.addWidget(b) b.connect("clicked()", self.prepareSolveStepByStep) w = QtGui.QWidget(self) hl = QtGui.QHBoxLayout(w) self.stepCount = QtGui.QSpinBox(w) self.stepCount.setRange(1, 1000) self.value = 1 hl.addWidget(self.stepCount) b = QtGui.QPushButton(self) b.text = "Execute N step" hl.addWidget(b) b.connect("clicked()", self.executeOneStep) box.addWidget(w) b = QtGui.QPushButton(self) b.text = "Finalize" box.addWidget(b) b.connect("clicked()", self.finishSolveStepByStep)
def showToolbarWidget(self): if app.getMainWindow() is None: return if self.toolbarWidget: self.execButton.setEnabled(True) return w = QtGui.QWidget() l = QtGui.QHBoxLayout(w) label = QtGui.QLabel('Walk plan:') execButton = QtGui.QPushButton('') execButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_MediaPlay)) clearButton = QtGui.QPushButton('') clearButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_TrashIcon)) stopButton = QtGui.QPushButton('') stopButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_MediaStop)) l.addWidget(label) l.addWidget(execButton) l.addWidget(stopButton) l.addWidget(clearButton) l.setContentsMargins(0, 0, 0, 0) execButton.setShortcut(QtGui.QKeySequence('Ctrl+Return')) execButton.connect('clicked()', self.onExecClicked) clearButton.connect('clicked()', self.onClearClicked) stopButton.connect('clicked()', self.sendStopWalking) self.execButton = execButton self.stopButton = stopButton self.toolbarWidget = app.getMainWindow().toolBar().addWidget(w) self.execButton.show()
def _makeTerrainWizard(self): terrainWizard = QtGui.QWidget() self.cinderBlockButton = QtGui.QToolButton() self.cinderBlock2Button = QtGui.QToolButton() self.cinderBlockButton.setIcon(QtGui.QIcon(':/images/cinderblock.png')) self.cinderBlock2Button.setIcon(QtGui.QIcon(':/images/cinderblock_double.png')) self.cinderBlockButton.setIconSize(QtCore.QSize(60,60)) self.cinderBlock2Button.setIconSize(QtCore.QSize(60,60)) self.cinderBlockButton.connect('clicked()', functools.partial(self.onTerrainCinderblockSelected, self.cinderBlockButton)) self.cinderBlock2Button.connect('clicked()', functools.partial(self.onTerrainCinderblockSelected, self.cinderBlock2Button)) buttons = QtGui.QWidget() l = QtGui.QHBoxLayout(buttons) l.setMargin(0) l.addStretch() l.addWidget(self.cinderBlockButton) l.addWidget(self.cinderBlock2Button) l.addStretch() l = QtGui.QVBoxLayout(terrainWizard) l.addWidget(buttons) l.addWidget(_makeButton('double wide', functools.partial(startInteractiveLineDraw, [0.1905*2, 0.149225]))) l.addStretch() return terrainWizard
def __init__(self, logPlayer): self.logPlayer = logPlayer w = QtGui.QWidget() w.windowTitle = 'LCM Log Playback' playButton = QtGui.QPushButton('Play') stopButton = QtGui.QPushButton('Stop') slider = QtGui.QSlider(QtCore.Qt.Horizontal) slider.maximum = int(logPlayer.getEndTime() * 100) text = QtGui.QLineEdit() text.text = '0.0' playButton.connect('clicked()', self.onPlay) stopButton.connect('clicked()', self.onStop) slider.connect('valueChanged(int)', self.onSlider) text.connect('returnPressed()', self.onText) l = QtGui.QHBoxLayout(w) l.addWidget(slider) l.addWidget(text) l.addWidget(playButton) l.addWidget(stopButton) self.slider = slider self.text = text self.widget = w self.widget.show()
def __init__(self, minValue=0.0, maxValue=1.0, resolution=1000): self._value = 0.0 self.spinbox = QtGui.QDoubleSpinBox() self.spinbox.setSuffix('s') self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.playButton = QtGui.QPushButton('Play') self.setValueRange(minValue, maxValue) self.setResolution(resolution) self.slider.connect('valueChanged(int)', self._onSliderValueChanged) self.spinbox.connect('valueChanged(double)', self._onSpinboxValueChanged) self.playButton.connect('clicked()', self._onPlayClicked) self.widget = QtGui.QWidget() layout = QtGui.QHBoxLayout(self.widget) layout.addWidget(self.playButton) layout.addWidget(self.spinbox) layout.addWidget(self.slider) self.animationPrevTime = 0.0 self.animationRate = 1.0 self.animationRateTarget = 1.0 self.animationRateAlpha = 1.0 self.animationTimer = TimerCallback(callback=self._tick, targetFps=60) self.useRealTime = True self.callbacks = callbacks.CallbackRegistry(self.events._fields) self.eventFilter = PythonQt.dd.ddPythonEventFilter() self.eventFilter.connect('handleEvent(QObject*, QEvent*)', self._filterEvent) self.eventFilter.addFilteredEventType(QtCore.QEvent.MouseButtonPress) self.eventFilter.addFilteredEventType(QtCore.QEvent.MouseMove) self.slider.installEventFilter(self.eventFilter)
def __init__(self, mode): super(CLCreate, self).__init__() ## Dialog Settings self.setFixedSize(300, 100) self.setWindowTitle('Select Channel') ## Vars self.mode = mode ## Layouts layoutV1 = Gui.QVBoxLayout() layoutH1 = Gui.QHBoxLayout() self.setLayout(layoutV1) ## Widgets self.chanCombo = Gui.QComboBox() self.okBtn = Gui.QPushButton('Ok') self.cancelBtn = Gui.QPushButton('Cancel') ## Populate layoutV1.addWidget(self.chanCombo) layoutV1.addLayout(layoutH1) layoutH1.addWidget(self.cancelBtn) layoutH1.addWidget(self.okBtn) ## Connections self.okBtn.connect("clicked()", self.runCreate) self.cancelBtn.connect("clicked()", self.close) ## Init self.init()
def launchViewer(self): playButtonFps = 1.0/self.options['Sim']['dt'] print "playButtonFPS", playButtonFps self.playTimer = TimerCallback(targetFps=playButtonFps) self.playTimer.callback = self.playTimerCallback panel = QtGui.QWidget() l = QtGui.QHBoxLayout(panel) playButton = QtGui.QPushButton('Play/Pause') playButton.connect('clicked()', self.onPlayButton) l.addWidget(playButton) w = QtGui.QWidget() l = QtGui.QVBoxLayout(w) l.addWidget(self.view) l.addWidget(panel) w.showMaximized() self.carFrame.connectFrameModified(self.updateDrawIntersection) self.updateDrawIntersection(self.carFrame) applogic.resetCamera(viewDirection=[0.2,0,-1]) self.view.showMaximized() self.view.raise_() self.app.start()
def __init__(self, parent): super(_PathManagement, self).__init__(parent) self.plugin = parent parent.widgetToRefresh.append(self) box = QtGui.QVBoxLayout(self) button = QtGui.QPushButton("Get paths", self) button.connect("clicked()", self.refresh) box.addWidget(button) box.addWidget(QtGui.QLabel("Choose the paths you want to concatenate.\n" "All the paths will be concatenate in the first choose.")) box.addWidget(QtGui.QLabel("List of path:")) self.paths = QtGui.QListWidget() box.addWidget(self.paths) self.paths.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) hBox = QtGui.QHBoxLayout() self.buttonConcatenate = QtGui.QPushButton("Concatenate") hBox.addWidget(self.buttonConcatenate) self.buttonConcatenate.connect("clicked()", self.concatenate) self.buttonErase = QtGui.QPushButton("Erase") hBox.addWidget(self.buttonErase) self.buttonErase.connect("clicked()", self.erase) box.addLayout(hBox)
def _makeBackButton(self): w = QtGui.QPushButton() w.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_ArrowBack)) w.connect('clicked()', self.onBackButton) frame = QtGui.QWidget() l = QtGui.QHBoxLayout(frame) l.setMargin(0) l.addWidget(w) l.addStretch() return frame
def makeForcesWidget(self, force): w = QtGui.QWidget() h = QtGui.QHBoxLayout(w) h.addWidget(QtGui.QLabel(force)) slider = QtGui.QSlider(QtCore.Qt.Horizontal) h.addWidget(slider) def onSliderChanged(value): print value, force slider.connect('valueChanged(int)', onSliderChanged) return w
def __init__(self, minValue=0.0, maxValue=1.0, resolution=1000): self.spinbox = QtGui.QDoubleSpinBox() self.spinbox.setSuffix('s') self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.setResolution(resolution) self.setValueRange(minValue, maxValue) self.slider.connect('valueChanged(int)', self._onSliderValueChanged) self.spinbox.connect('valueChanged(double)', self._onSpinboxValueChanged) self.widget = QtGui.QWidget() layout = QtGui.QHBoxLayout(self.widget) layout.addWidget(self.spinbox) layout.addWidget(self.slider) self.animationTimer = None self.callbacks = callbacks.CallbackRegistry(self.events._fields)
def __init__(self, handlers): # Create widget and layouts self._widget = QtGui.QWidget() self._image_widgets = map(ImageWidget, handlers) self._layout = QtGui.QHBoxLayout(self._widget) for image_widget in self._image_widgets: self._layout.addWidget(image_widget.get_widget()) self._layout.setContentsMargins(0, 0, 0, 0) default_width = 640 default_height = 480 dim = [default_width * len(self._image_widgets), default_height] self._widget.resize(*dim) self._widget.show()
def __init__(self, windowTitle='Task Panel'): loader = QtUiTools.QUiLoader() uifile = QtCore.QFile(':/ui/ddTaskUserPanel.ui') assert uifile.open(uifile.ReadOnly) self.widget = loader.load(uifile) self.ui = WidgetDict(self.widget.children()) self.widget.setWindowTitle(windowTitle) self.manualButtons = {} self.imageViewLayout = QtGui.QHBoxLayout(self.ui.imageFrame) self._setupParams() self._setupPropertiesPanel() self._initTaskPanel()
def setupPlayback(self): self.timer = TimerCallback(targetFps=30) self.timer.callback = self.tick playButtonFps = 1.0 / self.dt print "playButtonFPS", playButtonFps self.playTimer = TimerCallback(targetFps=playButtonFps) self.playTimer.callback = self.playTimerCallback self.sliderMovedByPlayTimer = False panel = QtGui.QWidget() l = QtGui.QHBoxLayout(panel) playButton = QtGui.QPushButton('Play/Pause') playButton.connect('clicked()', self.onPlayButton) slider = QtGui.QSlider(QtCore.Qt.Horizontal) slider.connect('valueChanged(int)', self.onSliderChanged) self.sliderMax = self.numTimesteps slider.setMaximum(self.sliderMax) self.slider = slider l.addWidget(playButton) l.addWidget(slider) w = QtGui.QWidget() l = QtGui.QVBoxLayout(w) l.addWidget(self.view) l.addWidget(panel) w.showMaximized() self.frame.connectFrameModified(self.updateDrawIntersection) self.updateDrawIntersection(self.frame) applogic.resetCamera(viewDirection=[0.2, 0, -1]) self.view.showMaximized() self.view.raise_() panel = screengrabberpanel.ScreenGrabberPanel(self.view) panel.widget.show() elapsed = time.time() - self.startSimTime simRate = self.counter / elapsed print "Total run time", elapsed print "Ticks (Hz)", simRate print "Number of steps taken", self.counter self.app.start()
def __init__(self, plugin): super(QCPWidget, self).__init__(plugin) self.plugin = plugin layout = QtGui.QVBoxLayout(self) from PythonQt.QCustomPlot import QCustomPlot, QCP self.qcpWidget = QCustomPlot() self.qcpWidget.autoAddPlottableToLegend = True self.qcpWidget.setInteraction(QCP.iRangeDrag, True) # iRangeDrap self.qcpWidget.setInteraction(QCP.iRangeZoom, True) # iRangeZoom self.qcpWidget.setInteraction(QCP.iSelectAxes, True) # iSelectAxes self.qcpWidget.legend().visible = True layout.addWidget(self.qcpWidget, 1) self.qcpWidget.connect(Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self._mouseDoubleClick) self.qcpWidget.xAxis().connect( Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) self.qcpWidget.yAxis().connect( Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged) buttonbar = QtGui.QWidget() bbLayout = QtGui.QHBoxLayout(buttonbar) button = QtGui.QPushButton("Replot", buttonbar) button.connect(QtCore.SIGNAL("clicked()"), self.refreshPlot) bbLayout.addWidget(button) button = QtGui.QPushButton("Remove", buttonbar) button.connect(QtCore.SIGNAL("clicked()"), self.removePlot) bbLayout.addWidget(button) button = QtGui.QPushButton("Legend", buttonbar) button.checkable = True button.checked = True button.connect(QtCore.SIGNAL("toggled(bool)"), self.toggleLegend) bbLayout.addWidget(button) button = QtGui.QPushButton(QtGui.QIcon.fromTheme("zoom-fit-best"), "", buttonbar) button.setToolTip("Zoom fit best") button.connect(QtCore.SIGNAL("clicked()"), self.qcpWidget.rescaleAxes) bbLayout.addWidget(button) self.xselect = QtGui.QComboBox(self) bbLayout.addWidget(self.xselect, 1) layout.addWidget(buttonbar) self.data = DataQCP(plugin, self.qcpWidget)
def __init__(self, model, jointController, view): self.model = model self.jointController = jointController self.view = view self.colorNoHighlight = QtGui.QColor(190, 190, 190) self.colorHighlight = QtCore.Qt.red self.timer = TimerCallback() self.timer.callback = self.update self.timer.targetFps = 60 #self.timer.start() self.collisionStateIds = [] self.lastRobotStateMessage = None self.lastPlanMessage = None self.lastPlanCheckMessage = None lcmUtils.addSubscriber('EST_ROBOT_STATE', lcmdrc.robot_state_t, self.onRobotState) lcmUtils.addSubscriber('ROBOT_COLLISIONS', lcmdrc.robot_collision_array_t, self.onPlanCheck) lcmUtils.addSubscriber('CANDIDATE_MANIP_PLAN', lcmdrc.robot_plan_w_keyframes_t, self.onManipPlan) w = QtGui.QWidget() l = QtGui.QHBoxLayout(w) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.clearButton = QtGui.QPushButton('clear') self.zeroButton = QtGui.QPushButton('zero') l.addWidget(self.clearButton) l.addWidget(self.zeroButton) l.addWidget(self.slider) self.slider.connect(self.slider, 'valueChanged(int)', self.onSlider) self.slider.connect(self.zeroButton, 'clicked()', self.onZeroButtonClicked) self.slider.connect(self.clearButton, 'clicked()', self.onClearButtonClicked) ww = QtGui.QWidget() ll = QtGui.QVBoxLayout(ww) ll.addWidget(self.view) ll.addWidget(w) ll.setMargin(0) ww.show() ww.resize(800, 600) self.widget = ww
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 initGUI(self): self.setWindowTitle("Watershed Splitter Hybrid Mode Widget") widgetLayout = QtGui.QVBoxLayout() self.setLayout(widgetLayout) self.markerRadiusEdit = QtGui.QLineEdit() self.baseSubObjIdEdit = QtGui.QLineEdit() self.workAreaSizeEdit = QtGui.QLineEdit() opButtonsLayout = QtGui.QHBoxLayout() widgetLayout.addLayout(opButtonsLayout) self.resetButton = QtGui.QPushButton("Reset") self.resetButton.enabled = False self.resetButton.clicked.connect(self.resetButtonClicked) opButtonsLayout.addWidget(self.resetButton) self.finishButton = QtGui.QPushButton("Finish") self.finishButton.enabled = False self.finishButton.clicked.connect(self.finishButtonClicked) opButtonsLayout.addWidget(self.finishButton) self.subObjTableGroupBox = QtGui.QGroupBox("SubObjects") subObjTableLayout = QtGui.QVBoxLayout() widgetLayout.addLayout(subObjTableLayout) self.subObjTableGroupBox.setLayout(subObjTableLayout) self.subObjTable = self.MyTableWidget(self.subObjTableDel) subObjTableWidget = QtGui.QWidget() subObjTableLayout.addWidget(subObjTableWidget) subObjTableLayout = QtGui.QVBoxLayout() subObjTableWidget.setLayout(subObjTableLayout) subObjTableLayout.addWidget(self.subObjTable) self.setTableHeaders(self.subObjTable, self.OBJECT_LIST_COLUMNS) self.finalizeTable(self.subObjTable) # Invisibles self.widgetWidthEdit = QtGui.QLineEdit() self.widgetHeightEdit = QtGui.QLineEdit() self.widgetLeftEdit = QtGui.QLineEdit() self.widgetTopEdit = QtGui.QLineEdit() self.curFont = QtGui.QFont() # Window settings self.setWindowFlags(Qt.Qt.Window) # Yes, this has to be a called separately, or else the next call works wrong self.setWindowFlags((self.windowFlags() | Qt.Qt.CustomizeWindowHint) & ~Qt.Qt.WindowCloseButtonHint) self.resize(0,0) return
def __init__(self, robotSystem, cameraView): self.meshPoints = None self.imagePoints = None self.cameraView = cameraView self.robotMesh = vtk.vtkPolyData() robotSystem.robotStateModel.model.getModelMesh(self.robotMesh) self.robotBaseFrame = robotSystem.robotStateModel.getLinkFrame('base') self.view = PythonQt.dd.ddQVTKWidgetView() vis.showPolyData(self.robotMesh, 'robot mesh', view=self.view) self.imageFitter = ImageFitter(self) vis.showPolyData(self.imageFitter.getPointCloud(), 'pointcloud', view=self.view, colorByName='rgb_colors', visible=False) self.picker = pointpicker.PointPicker(self.view) self.picker.pickType = 'cells' self.picker.numberOfPoints = 3 self.picker.annotationName = 'mesh annotation' self.picker.annotationFunc = self.onPickPoints self.picker.start() self.widget = QtGui.QWidget() layout = QtGui.QHBoxLayout(self.widget) layout.addWidget(self.cameraView.view) layout.addWidget(self.view) self.widget.resize(800, 400) self.widget.setWindowTitle('Camera Alignment Tool') self.widget.show() self.viewBehaviors = viewbehaviors.ViewBehaviors(self.view) applogic.resetCamera(viewDirection=[0, 1, 0], view=self.view) applogic.setCameraTerrainModeEnabled(self.view, True)
def __init__(self, robotNames=[]): """ Initialise the selector object :param robotNames: The names of robots to add to the combobox to start with """ super(RobotSelector, self).__init__() self.objectName = "RobotSelector" self.robotNames = robotNames self.associatedWidgets = ( {}) # associated objects are stored here. Keys are robot names self.robotSelectLabel = QtGui.QLabel("Controlling:") self.robotSelectCombo = QtGui.QComboBox() for robotName in self.robotNames: self.addRobot(robotName) self.horizLayout = QtGui.QHBoxLayout(self) self.horizLayout.addWidget(self.robotSelectLabel) self.horizLayout.addWidget(self.robotSelectCombo) self.robotSelectCombo.connect("currentIndexChanged(QString)", self.showAssociatedComponents)
def __init__(self, cameraView, modelPolyData=None, pointCloud=None, resultsDict=None, visualize=True, callback=None): self.modelPolyData = modelPolyData self.pointCloud = pointCloud self.resultsDict = resultsDict self.visualize = visualize self.callback = callback self.parent = om.getOrCreateContainer('object alignment') self.meshPoints = None self.imagePoints = None self.cameraView = cameraView # viewer for the object self.view = PythonQt.dd.ddQVTKWidgetView() # add some special logic to show colors if they exist colorByName = 'RGB255' if not self.modelPolyData.GetPointData().GetArray(colorByName): colorByName = None vis.showPolyData(self.modelPolyData, 'object poly data', view=self.view, parent=self.parent, colorByName=colorByName) self.imageFitter = ImageFitter(self, pointCloud) self.picker = pointpicker.PointPicker(self.view) self.picker.pickType = 'cells' # might need to change this self.picker.numberOfPoints = 3 self.picker.annotationName = 'mesh annotation' self.picker.annotationFunc = self.onPickPoints self.picker.start() # viewer for the pointcloud self.sceneView = PythonQt.dd.ddQVTKWidgetView() vis.showPolyData(self.pointCloud, 'pointcloud', view=self.sceneView, colorByName='RGB', parent=self.parent) self.scenePicker = pointpicker.PointPicker(self.sceneView) self.scenePicker.pickType = 'points' # might need to change this self.scenePicker.numberOfPoints = 3 self.scenePicker.annotationName = 'pointcloud annotation' self.scenePicker.annotationFunc = self.onScenePickPoints self.scenePicker.start() # workaround bug in PointPicker implementation for name in [self.picker.annotationName, self.scenePicker.annotationName]: om.removeFromObjectModel(om.findObjectByName(name)) self.widget = QtGui.QWidget() layout = QtGui.QHBoxLayout(self.widget) # layout.addWidget(self.cameraView.view) layout.addWidget(self.sceneView) layout.addWidget(self.view) # self.widget.resize(800, 400) self.widget.showMaximized() self.widget.setWindowTitle('Camera Alignment Tool') self.widget.show() self.viewBehaviors = viewbehaviors.ViewBehaviors(self.view) applogic.resetCamera(viewDirection=[0,1,0], view=self.view) applogic.setCameraTerrainModeEnabled(self.view, True) self.sceneViewBehaviors = viewbehaviors.ViewBehaviors(self.sceneView) applogic.resetCamera(viewDirection=[0, 1, 0], view=self.sceneView) applogic.setCameraTerrainModeEnabled(self.sceneView, True)
def addWidgetsInHBox(self, widgets): nameParentW = QtGui.QWidget(self) hboxName = QtGui.QHBoxLayout(nameParentW) for w in widgets: hboxName.addWidget(w) return nameParentW
def _makeDrillWizard(self): drillWizard = QtGui.QGroupBox('Drill Segmentation') l = QtGui.QVBoxLayout(drillWizard) l.addWidget( _makeButton('segment drill aligned with table', startDrillAutoSegmentationAlignedWithTable)) l.addWidget( _makeButton('segment target using wall center', segmentDrillWallFromWallCenter)) self.drillUpdater = TimerCallback() self.drillUpdater.targetFps = 30 self.drillUpdater.callback = self.moveDrillToHand hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) self.moveDrillToHandButton = _makeButton('move drill to hand', self.onMoveDrillToHandClicked) self.moveDrillToHandButton.checkable = True hl.addWidget(self.moveDrillToHandButton) self.handCombo = QtGui.QComboBox() self.handCombo.addItem('left') self.handCombo.addItem('right') hl.addWidget(self.handCombo) hl.addWidget(_makeButton('flip z', self.flipDrill)) self.drillFlip = False l.addWidget(hw) # In Degrees self.drillRotationSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillRotationSlider.setMinimum(-90) self.drillRotationSlider.setMaximum(270) self.drillRotationSlider.setValue(90) # All in MM self.drillOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillOffsetSlider.setMinimum(-100) self.drillOffsetSlider.setMaximum(100) self.drillOffsetSlider.setValue(30) self.drillDepthOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillDepthOffsetSlider.setMinimum(-10) self.drillDepthOffsetSlider.setMaximum(90) self.drillDepthOffsetSlider.setValue(40) self.drillLateralOffsetSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.drillLateralOffsetSlider.setMinimum(-50) self.drillLateralOffsetSlider.setMaximum(50) self.drillLateralOffsetSlider.setValue(-23) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget(self.drillRotationSlider) hl.addWidget(self.drillOffsetSlider) hw.connect(self.drillRotationSlider, 'valueChanged(int)', self.moveDrillToHand) hw.connect(self.drillOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget(self.drillDepthOffsetSlider) hl.addWidget(self.drillLateralOffsetSlider) hw.connect(self.drillDepthOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) hw.connect(self.drillLateralOffsetSlider, 'valueChanged(int)', self.moveDrillToHand) l.addWidget(hw) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.setMargin(0) hl.addWidget( _makeButton('segment button', startDrillButtonSegmentation)) hl.addWidget(_makeButton('segment tip', startPointerTipSegmentation)) self.drillFlip = False l.addWidget(hw) l.addWidget(QtGui.QLabel('')) hw = QtGui.QWidget() hl = QtGui.QHBoxLayout(hw) hl.addWidget(QtGui.QLabel('right angle:')) hl.setMargin(0) self.rightAngleCombo = QtGui.QComboBox() self.rightAngleCombo.addItem(DRILL_TRIANGLE_BOTTOM_LEFT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_BOTTOM_RIGHT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_TOP_LEFT) self.rightAngleCombo.addItem(DRILL_TRIANGLE_TOP_RIGHT) hl.addWidget(self.rightAngleCombo) l.addWidget(hw) l.addWidget( _makeButton('segment drill on table', startDrillAutoSegmentation)) l.addWidget( _makeButton('segment wall', self.segmentDrillWallConstrained)) l.addWidget(_makeButton('refit wall', startRefitWall)) l.addWidget(QtGui.QLabel('')) l.addStretch() return drillWizard
def setupUi(self): #set Main Window Title. self.setWindowTitle("xg Texture Exporter") self.setObjectName("xgTextureExportGUI") self.setEnabled(True) self.resize(545, 702) ##===================================== CentralLayout ============================ self.centralwidget = QtGui.QWidget() self.centralwidget.setObjectName("centralwidget") ##===================================== MasterLayout ============================ self.master_GridLayout = QtGui.QGridLayout(self.centralwidget) self.master_GridLayout.setObjectName("master_GridLayout") ##===================================== TopLayout ============================ self.top_GridLayout = QtGui.QGridLayout() self.top_GridLayout.setObjectName("top_GridLayout") ##=======exportPathLine======## self.exportPathLineEdit = QtGui.QLineEdit(self.centralwidget) self.exportPathLineEdit.setMinimumSize(QtCore.QSize(0, 30)) self.exportPathLineEdit.setObjectName("exportPathLineEdit") self.top_GridLayout.addWidget(self.exportPathLineEdit, 2, 0, 1, 1) ##=======FolderLable=======## self.outputFolderLabel = QtGui.QLabel("Output Folder", self.centralwidget) setBold(self.outputFolderLabel) self.outputFolderLabel.setObjectName("outputFolderLabel") self.top_GridLayout.addWidget(self.outputFolderLabel, 0, 0, 1, 1) ##=======BrowseButton=======## self.browseButton = xgPushButton("browseButton", "Browse", 0, "Choose texture output directory.") self.browseButton.setMinimumSize(QtCore.QSize(0, 30)) self.top_GridLayout.addWidget(self.browseButton, 2, 1, 1, 1) self.master_GridLayout.addLayout(self.top_GridLayout, 0, 0, 1, 1) ##===================================== MidLayout ============================ self.mid_HBoxLayout = QtGui.QHBoxLayout() self.mid_HBoxLayout.setObjectName("mid_HBoxLayout") self.midLeft_GridLayout = QtGui.QGridLayout() self.midLeft_GridLayout.setObjectName("midLeft_GridLayout") ##=======channelsLable=======## self.channels_Label = QtGui.QLabel("Channels", self.centralwidget) setBold(self.channels_Label) self.channels_Label.setObjectName("channels_Label") self.midLeft_GridLayout.addWidget(self.channels_Label, 0, 0, 1, 1) ##=======ChannelButtons=======## self.removeChannel_Button = xgPushButton( "removeChannel_Button", "-", 0, "remove selected channels from export list.") self.removeChannel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.addChannel_Button = xgPushButton( "addChannel_Button", "+", 0, "add selected channels to export list.") self.addChannel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.midLeft_GridLayout.addWidget(self.addChannel_Button, 2, 0, 1, 1) self.midLeft_GridLayout.addWidget(self.removeChannel_Button, 2, 1, 1, 1) ##=======ChannelList=======## self.channelsList_ListWidget = ChannelsToExportList() self.channelsList_ListWidget.isSortingEnabled() self.channelsList_ListWidget.setSortingEnabled(False) self.channelsList_ListWidget.setObjectName("channelsList_ListWidget") QtGui.QListWidgetItem(self.channelsList_ListWidget) self.midLeft_GridLayout.addWidget(self.channelsList_ListWidget, 1, 0, 1, 2) self.mid_HBoxLayout.addLayout(self.midLeft_GridLayout) self.options_GroupBox = QtGui.QGroupBox("Options", self.centralwidget) self.options_GroupBox.setObjectName("options_GroupBox") self.outputFormat_Label = QtGui.QLabel("Output Format :", self.options_GroupBox) self.outputFormat_Label.setGeometry(QtCore.QRect(20, 40, 121, 21)) self.outputFormat_Label.setObjectName("outputFormat_Label") self.resolution_Label = QtGui.QLabel("Resolution:", self.options_GroupBox) self.resolution_Label.setGeometry(QtCore.QRect(20, 70, 121, 21)) self.resolution_Label.setObjectName("resolution_Label") self.processTextures_Label = QtGui.QLabel("process textures:", self.options_GroupBox) self.processTextures_Label.setGeometry(QtCore.QRect(20, 130, 121, 21)) self.processTextures_Label.setObjectName("processTextures_Label") ##=======Options=======## self.outFormat_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.outFormat_ComboBox.setToolTip("define output texture format.") self.outFormat_ComboBox.setGeometry(QtCore.QRect(130, 40, 81, 25)) self.outFormat_ComboBox.setEditable(False) self.outFormat_ComboBox.setObjectName("outFormat_ComboBox") self.outFormat_ComboBox.addItem("exr") self.outFormat_ComboBox.addItem("tif") self.outFormat_ComboBox.setCurrentIndex(1) self.resolution_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.resolution_ComboBox.setToolTip( "define output texture resolution.") self.resolution_ComboBox.setGeometry(QtCore.QRect(100, 70, 111, 25)) self.resolution_ComboBox.setObjectName("resolution_ComboBox") self.resolution_ComboBox.addItem("channel res") self.resolution_ComboBox.addItem("full (8K)") self.resolution_ComboBox.addItem("heigh (4K)") self.resolution_ComboBox.addItem("mid (2K)") self.resolution_ComboBox.addItem("low (1K)") self.clearExpChan_CheckBox = QtGui.QCheckBox("Clear export channels", self.options_GroupBox) self.clearExpChan_CheckBox.setGeometry(QtCore.QRect(20, 100, 181, 23)) self.clearExpChan_CheckBox.setChecked(True) self.clearExpChan_CheckBox.setObjectName("clearExpChan_CheckBox") self.clearExpChan_CheckBox.setToolTip( "delete the flattened channels after export.") self.processTextures_ComboBox = QtGui.QComboBox(self.options_GroupBox) self.processTextures_ComboBox.setToolTip( "define textures processing method.") self.processTextures_ComboBox.setGeometry( QtCore.QRect(135, 130, 105, 25)) self.processTextures_ComboBox.setObjectName("processTextures_ComboBox") self.processTextures_ComboBox.addItem("None") self.processTextures_ComboBox.addItem("Local process") #self.processTextures_ComboBox.addItem("Farm process") #self.texturePublish_CheckBox = QtGui.QCheckBox("Publish farm Textures", self.options_GroupBox) #self.texturePublish_CheckBox.setToolTip("process textures on the farm via texturePublish. \n (convert only will not publish.)") #self.texturePublish_CheckBox.setGeometry(QtCore.QRect(20, 160, 181, 23)) #self.texturePublish_CheckBox.setCheckable(False) #self.texturePublish_CheckBox.setObjectName("texturePublish_CheckBox") ''' self.linear_CheckBox = QtGui.QCheckBox("Local process textures.", self.options_GroupBox) self.linear_CheckBox.setToolTip("convert textures to Mipmap exr localy.") self.linear_CheckBox.setGeometry(QtCore.QRect(20, 130, 181, 23)) #self.linear_CheckBox.setChecked(True) self.linear_CheckBox.setObjectName("linear_CheckBox") self.publish_CheckBox = QtGui.QCheckBox("Publish After Export", self.options_GroupBox) self.publish_CheckBox.setGeometry(QtCore.QRect(20, 190, 181, 23)) self.publish_CheckBox.setCheckable(False) self.publish_CheckBox.setObjectName("publish_CheckBox") ''' self.mid_HBoxLayout.addWidget(self.options_GroupBox) self.master_GridLayout.addLayout(self.mid_HBoxLayout, 1, 0, 1, 1) self.bottom_VBoxLayout = QtGui.QVBoxLayout() self.bottom_VBoxLayout.setObjectName("bottom_VBoxLayout") self.exportChannels_Label = QtGui.QLabel("Channels For Export", self.centralwidget) self.exportChannels_Label.setObjectName("exportChannels_Label") setBold(self.exportChannels_Label) self.bottom_VBoxLayout.addWidget(self.exportChannels_Label) ##======table=======## self.exportChannelsList_tableWidget = QtGui.QTableWidget( self.centralwidget) self.exportChannelsList_tableWidget.setWordWrap(True) self.exportChannelsList_tableWidget.setCornerButtonEnabled(True) #self.exportChannelsList_tableWidget.setRowCount(2) self.exportChannelsList_tableWidget.setObjectName( "exportChannelsList_tableWidget") self.exportChannelsList_tableWidget.setColumnCount(5) self.exportChannelsList_tableWidget.setRowCount(0) self.exportChannelsList_tableWidget.setSelectionBehavior( QtGui.QAbstractItemView.SelectRows) self.exportChannelsList_tableWidget.setSelectionMode( QtGui.QAbstractItemView.SingleSelection) self.exportChannelsList_tableWidget.horizontalHeader().setVisible(True) self.exportChannelsList_tableWidget.horizontalHeader( ).setCascadingSectionResizes(False) self.exportChannelsList_tableWidget.horizontalHeader( ).setMinimumSectionSize(25) self.exportChannelsList_tableWidget.horizontalHeader( ).setSortIndicatorShown(False) #self.exportChannelsList_tableWidget.horizontalHeader().setStretchLastSection(True) self.exportChannelsList_tableWidget.verticalHeader( ).setCascadingSectionResizes(False) self.exportChannelsList_tableWidget.verticalHeader( ).setDefaultSectionSize(28) self.exportChannelsList_tableWidget.verticalHeader( ).setMinimumSectionSize(10) self.itemLine0 = QtGui.QLineEdit("channel") self.item0 = QtGui.QTableWidgetItem(self.itemLine0.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 0, self.item0) self.itemLine1 = QtGui.QLineEdit("type") self.item1 = QtGui.QTableWidgetItem(self.itemLine1.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 1, self.item1) self.itemLine2 = QtGui.QLineEdit("version") self.item2 = QtGui.QTableWidgetItem(self.itemLine2.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 2, self.item2) self.itemLine3 = QtGui.QLineEdit("non_color") self.item3 = QtGui.QTableWidgetItem(self.itemLine3.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 3, self.item3) self.itemLine4 = QtGui.QLineEdit("variation") self.item4 = QtGui.QTableWidgetItem(self.itemLine4.text) self.exportChannelsList_tableWidget.setHorizontalHeaderItem( 4, self.item4) self.exportChannelsList_tableWidget.horizontalHeader( ).setCascadingSectionResizes(False) self.bottom_VBoxLayout.addWidget(self.exportChannelsList_tableWidget) self.exportButton_HBoxLayout = QtGui.QHBoxLayout() self.exportButton_HBoxLayout.setObjectName("exportButton_HBoxLayout") self.cancel_Button = xgPushButton("cancel_Button", "Cancel", 1) self.cancel_Button.setMinimumSize(QtCore.QSize(0, 45)) self.exportButton_HBoxLayout.addWidget(self.cancel_Button) self.exportPatch_Button = xgPushButton("exportPatch_Button", "Export Selected Patches", 1) self.exportPatch_Button.setMinimumSize(QtCore.QSize(200, 45)) self.exportButton_HBoxLayout.addWidget(self.exportPatch_Button) self.export_Button = xgPushButton("export_Button", "Export", 0) self.export_Button.setMinimumSize(QtCore.QSize(200, 45)) self.exportButton_HBoxLayout.addWidget(self.export_Button) self.bottom_VBoxLayout.addLayout(self.exportButton_HBoxLayout) self.master_GridLayout.addLayout(self.bottom_VBoxLayout, 2, 0, 1, 1) self.setLayout(self.master_GridLayout)