def __init__(self, parent,silhouette,completeness,homogeneity,v_score,AMI,ARS): QDialog.__init__( self, parent ) layout = QVBoxLayout() viewLayout = QFormLayout() viewLayout.addRow(QLabel('Silhouette score: '),QLabel(silhouette)) viewLayout.addRow(QLabel('Completeness: '),QLabel(completeness)) viewLayout.addRow(QLabel('Homogeneity: '),QLabel(homogeneity)) viewLayout.addRow(QLabel('V score: '),QLabel(v_score)) viewLayout.addRow(QLabel('Adjusted mutual information: '),QLabel(AMI)) viewLayout.addRow(QLabel('Adjusted Rand score: '),QLabel(ARS)) viewWidget = QGroupBox() viewWidget.setLayout(viewLayout) layout.addWidget(viewWidget) #Accept cancel self.acceptButton = QPushButton('Ok') self.cancelButton = QPushButton('Cancel') self.acceptButton.clicked.connect(self.accept) self.cancelButton.clicked.connect(self.reject) hbox = QHBoxLayout() hbox.addWidget(self.acceptButton) hbox.addWidget(self.cancelButton) ac = QWidget() ac.setLayout(hbox) layout.addWidget(ac) self.setLayout(layout)
def setup_general_server_group(self): """ Setup the 'Server' group in the 'General' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Server') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) email, password = self.auth_credentials() self.email_edit = QLineEdit(email) self.email_edit.textChanged.connect(self.update_auth) layout.addRow('Email', self.email_edit) self.password_edit = QLineEdit(password) self.password_edit.setEchoMode(QLineEdit.Password) self.password_edit.textChanged.connect(self.update_auth) layout.addRow('Password', self.password_edit) show_password_widget = QCheckBox() show_password_widget.stateChanged.connect(self.on_show_password_toggle) layout.addRow('Show password', show_password_widget) test_authentication_button = QPushButton('Test Authentication') test_authentication_button.clicked.connect(self.on_test_authentication) layout.addRow(test_authentication_button) group.setLayout(layout) return group
def buildAttributeGroupBox(self): """Layout/construct the AttributeScene UI for this tab.""" groupBox = QGroupBox("Attribute Policy (Colors)") layout = QVBoxLayout() # agent.propagate_attribute_scenes self.attr_propagate = QCheckBox( "Propagate attribute scene " + "information (e.g. color maps) to other modules." ) self.attr_propagate.setChecked(self.agent.propagate_attribute_scenes) self.attr_propagate.stateChanged.connect(self.attrPropagateChanged) # We only allow this change if the parent does not propagate if self.agent.parent().propagate_attribute_scenes: self.attr_propagate.setDisabled(True) # agent.apply_attribute_scenes self.attr_applyScene = QCheckBox("Apply attribute scene information " + "from other modules.") self.attr_applyScene.setChecked(self.agent.apply_attribute_scenes) self.attr_applyScene.stateChanged.connect(self.attrApplyChanged) layout.addWidget(self.attr_applyScene) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.attr_propagate) groupBox.setLayout(layout) return groupBox
def _buildResultsPanel(self): ''' Creates the sub-panel containing displays widgets for informing the user on the results of running the algorithm. ''' self._doneLbl = QLabel("No", self._window) self._solvableLbl = QLabel("Yes", self._window) #_doneLbl is highlighted green upon successful algorithm completion pal = self._doneLbl.palette() pal.setColor(QPalette.Window, Qt.green) self._doneLbl.setPalette(pal) #_solvableLbl is highlighted red if the world model isn't solvable pal = self._solvableLbl.palette() pal.setColor(QPalette.Window, Qt.red) self._solvableLbl.setPalette(pal) layout = QGridLayout() layout.addWidget(QLabel("Path Found:"), 0, 0) layout.addWidget(self._doneLbl, 0, 1) layout.addWidget(QLabel("Is Solvable:"), 1, 0) layout.addWidget(self._solvableLbl, 1, 1) grpBx = QGroupBox("Results") grpBx.setLayout(layout) grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) return grpBx
def _init_load_options_tab(self, tab): # auto load libs auto_load_libs = QCheckBox(self) auto_load_libs.setText("Automatically load all libraries") auto_load_libs.setChecked(False) self.option_widgets['auto_load_libs'] = auto_load_libs # dependencies list dep_group = QGroupBox("Dependencies") dep_list = QListWidget(self) self.option_widgets['dep_list'] = dep_list sublayout = QVBoxLayout() sublayout.addWidget(dep_list) dep_group.setLayout(sublayout) layout = QVBoxLayout() layout.addWidget(auto_load_libs) layout.addWidget(dep_group) layout.addStretch(0) frame = QFrame(self) frame.setLayout(layout) tab.addTab(frame, "Loading Options")
def __init__(self,parent=None): super(QtReducePreferencesWorksheet,self).__init__(parent) fontGroup = QGroupBox(self.tr("Fonts")) self.fontCombo = QtReduceFontComboBox(self) self.setFocusPolicy(Qt.NoFocus) self.fontCombo.setEditable(False) self.fontCombo.setCurrentFont(self.parent().parent().controller.view.font()) self.sizeCombo = QtReduceFontSizeComboBox() self.sizeComboFs = QtReduceFontSizeComboBoxFs() self.findSizes(self.fontCombo.currentFont()) self.fontCombo.currentFontChanged.connect(self.findSizes) fontLayout = QFormLayout() fontLayout.addRow(self.tr("General Worksheet Font"),self.fontCombo) fontLayout.addRow(self.tr("Font Size"),self.sizeCombo) fontLayout.addRow(self.tr("Full Screen Font Size"),self.sizeComboFs) fontGroup.setLayout(fontLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(fontGroup) self.setLayout(mainLayout)
def _buildSpeedPanel(self): ''' Creates the sub-panel containing control widgets for controlling the speed of execution of the algorithm. ''' self._runBtn = QPushButton("Run", self._window) self._stepBtn = QPushButton("Step Once", self._window) self._runBtn.clicked.connect(self._onRun) self._stepBtn.clicked.connect(self._onStep) slowRadio = QRadioButton('Slow', self._window) medRadio = QRadioButton('Medium', self._window) fastRadio = QRadioButton('Fast', self._window) notVisRadio = QRadioButton('Not visible', self._window) slowRadio.setChecked(True) self._speedGroup = QButtonGroup(self._window) self._speedGroup.addButton(slowRadio, 0) self._speedGroup.addButton(medRadio, 1) self._speedGroup.addButton(fastRadio, 2) self._speedGroup.addButton(notVisRadio, 3) self._speedGroup.buttonClicked.connect(self._onSpeedChange) layout = QVBoxLayout() layout.addWidget(self._runBtn) layout.addWidget(self._stepBtn) layout.addWidget(slowRadio) layout.addWidget(medRadio) layout.addWidget(fastRadio) layout.addWidget(notVisRadio) grpBx = QGroupBox("Run Controls") grpBx.setLayout(layout) grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) return grpBx
def setupUI(self): layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) selectGroup = QGroupBox("Select") form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) selectGroup.setLayout(form1) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(selectGroup) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) self.setLayout(layout)
def _buildSetupPanel(self): ''' Creates the sub-panel containing control widgets for re-initializing the world on demand. ''' self._percentLbl = QLabel("%") self._setupBtn = QPushButton("Setup", self._window) self._setupBtn.clicked.connect(self._onSetup) self._percentObstacleSldr = QSlider(Qt.Horizontal, self._window) self._percentObstacleSldr.setTickPosition(QSlider.TickPosition.TicksBelow) self._percentObstacleSldr.setTickInterval(10) self._percentObstacleSldr.setMinimum(0) self._percentObstacleSldr.setMaximum(100) self._percentObstacleSldr.valueChanged.connect(self._onPercentSlideChange) self._percentObstacleSldr.setValue(33) layout = QGridLayout() layout.addWidget(self._setupBtn, 0, 0, 1, 2) layout.addWidget(QLabel("Percent Occupied:"), 1, 0) layout.addWidget(self._percentLbl, 1, 1) layout.addWidget(self._percentObstacleSldr, 2, 0, 1, 2) grpBx = QGroupBox("Setup Controls") grpBx.setLayout(layout) grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) return grpBx
def __init__(self, title, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title sgCmds.makeFile( self.infoPath ) layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) layout.addWidget( groupBox ) baseLayout = QVBoxLayout() groupBox.setLayout( baseLayout ) listWidget = QListWidget() hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 ) b_addSelected = QPushButton( "Add Selected" ) b_clear = QPushButton( "Clear" ) hl_buttons.addWidget( b_addSelected ) hl_buttons.addWidget( b_clear ) baseLayout.addWidget( listWidget ) baseLayout.addLayout( hl_buttons ) self.listWidget = listWidget QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem ) QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected ) QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected ) self.otherWidget = None self.loadInfo()
def __init__(self,parent=None): super(QtReducePreferencesComputation,self).__init__(parent) reduceGroup = QGroupBox("Reduce") self.reduceBinary = QLineEdit() # font = self.reduceBinary.font() # font.setFamily(QSettings().value("worksheet/fontfamily", # QtReduceDefaults.FONTFAMILY)) # self.reduceBinary.setFont(font) self.reduceBinary.setText(QSettings().value("computation/reduce", QtReduceDefaults.REDUCE)) self.reduceBinary.editingFinished.connect(self.editingFinishedHandler) reduceLayout = QFormLayout() reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary) reduceGroup.setLayout(reduceLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(reduceGroup) self.setLayout(mainLayout)
def buildModuleGroupBox(self): """Layout/construct the ModuleScene UI for this tab.""" groupBox = QGroupBox("Module Policy") layout = QVBoxLayout() # agent.propagate_module_scenes self.module_propagate = QCheckBox( "Propagate module scene information " + "to other modules.") self.module_propagate.setChecked(self.agent.propagate_module_scenes) self.module_propagate.stateChanged.connect(self.modulePropagateChanged) # We only allow this change if the parent does not propagate if self.agent.parent().propagate_module_scenes: self.module_propagate.setDisabled(True) # agent.apply_module_scenes self.module_applyScene = QCheckBox("Apply module scene information " + "from other modules.") self.module_applyScene.setChecked(self.agent.apply_module_scenes) self.module_applyScene.stateChanged.connect(self.moduleApplyChanged) layout.addWidget(self.module_applyScene) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.module_propagate) groupBox.setLayout(layout) return groupBox
def buildAttributeGroupBox(self): """Layout/construct the AttributeScene UI for this tab.""" groupBox = QGroupBox("Attribute Policy (Colors)") layout = QVBoxLayout() # agent.propagate_attribute_scenes self.attr_propagate = QCheckBox( "Propagate attribute scene " + "information (e.g. color maps) to other modules.") self.attr_propagate.setChecked(self.agent.propagate_attribute_scenes) self.attr_propagate.stateChanged.connect(self.attrPropagateChanged) # We only allow this change if the parent does not propagate if self.agent.parent().propagate_attribute_scenes: self.attr_propagate.setDisabled(True) # agent.apply_attribute_scenes self.attr_applyScene = QCheckBox("Apply attribute scene information " + "from other modules.") self.attr_applyScene.setChecked(self.agent.apply_attribute_scenes) self.attr_applyScene.stateChanged.connect(self.attrApplyChanged) layout.addWidget(self.attr_applyScene) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.attr_propagate) groupBox.setLayout(layout) return groupBox
def buildHighlightGroupBox(self): """Layout/construct the highlight UI for this tab.""" groupBox = QGroupBox("Highlight Policy") layout = QVBoxLayout() # agent.propagate_highlights self.highlights_propagate = QCheckBox("Propagate highlights to " + "other modules.") self.highlights_propagate.setChecked(self.agent.propagate_highlights) self.highlights_propagate.stateChanged.connect( self.highlightsPropagateChanged) # We only allow this change if the parent does not propagate if self.agent.parent().propagate_highlights: self.highlights_propagate.setDisabled(True) # agent.apply_highlights self.applyHighlights = QCheckBox("Apply highlights from " + "other modules.") self.applyHighlights.setChecked(self.agent.apply_highlights) self.applyHighlights.stateChanged.connect(self.applyHighlightsChanged) layout.addWidget(self.applyHighlights) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.highlights_propagate) groupBox.setLayout(layout) return groupBox
def buildWorkFrame(self): """Creates the grouped set of widgets that allow users to build basic Clause objects. """ groupBox = QGroupBox("Clause Workspace") layout = QHBoxLayout(groupBox) attributeCompleter = QCompleter(self.attributes) attributeCompleter.setCompletionMode(QCompleter.InlineCompletion) self.dropAttribute = DropLineEdit(self, self.mframe.agent.datatree, "", attributeCompleter) self.dropRelation = DropTextLabel("__") self.dropValue = FilterValueLineEdit(groupBox, self.mframe.agent.datatree, self.dropAttribute) # Clear dropValue when dropAttribute changes self.dropAttribute.textChanged.connect(self.dropValue.clear) # Enter in dropValue works like addButton self.dropValue.returnPressed.connect(self.addClause) self.addButton = QPushButton("Add", groupBox) self.addButton.clicked.connect(self.addClause) layout.addWidget(self.dropAttribute) layout.addItem(QSpacerItem(5,5)) layout.addWidget(self.dropRelation) layout.addItem(QSpacerItem(5,5)) layout.addWidget(self.dropValue) layout.addItem(QSpacerItem(5,5)) layout.addWidget(self.addButton) groupBox.setLayout(layout) return groupBox
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) title = "" if kwargs.has_key( 'title' ): title = kwargs['title'] self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title sgCmds.makeFile( self.infoPath ) vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) groupBox.setAlignment( QtCore.Qt.AlignCenter ) vLayout.addWidget( groupBox ) hLayout = QHBoxLayout() lineEdit = QLineEdit() button = QPushButton("Load"); button.setFixedWidth( 50 ) hLayout.addWidget( lineEdit ) hLayout.addWidget( button ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex ) self.loadInfo()
def _initUI(self): # Variables result = self.result() transitions = sorted(result.iter_transitions()) transition0 = transitions[0] model = _TransitionListModel(transitions) # Widgets self._chk_errorbar = QCheckBox("Show error bars") self._chk_errorbar.setChecked(True) self._cb_transition = QComboBox() self._cb_transition.setModel(model) self._cb_transition.setCurrentIndex(0) self._chk_pg = QCheckBox("No absorption, no fluorescence") state = result.exists(transition0, True, False, False, False) self._chk_pg.setEnabled(state) self._chk_pg.setChecked(state) self._chk_eg = QCheckBox("With absorption, no fluorescence") state = result.exists(transition0, True, True, False, False) self._chk_eg.setEnabled(state) self._chk_eg.setChecked(state) self._chk_pt = QCheckBox("No absorption, with fluorescence") state = result.exists(transition0, True, False, True, True) self._chk_pt.setEnabled(state) self._chk_pt.setChecked(state) self._chk_et = QCheckBox("With absorption, with fluorescence") state = result.exists(transition0, True, True, True, True) self._chk_et.setEnabled(state) self._chk_et.setChecked(state) # Layouts layout = _ResultToolItem._initUI(self) layout.addRow(self._chk_errorbar) layout.addRow("Transition", self._cb_transition) boxlayout = QVBoxLayout() boxlayout.addWidget(self._chk_pg) boxlayout.addWidget(self._chk_eg) boxlayout.addWidget(self._chk_pt) boxlayout.addWidget(self._chk_et) box_generated = QGroupBox("Curves") box_generated.setLayout(boxlayout) layout.addRow(box_generated) # Signals self._cb_transition.currentIndexChanged.connect(self._onTransitionChanged) self._chk_pg.stateChanged.connect(self.stateChanged) self._chk_eg.stateChanged.connect(self.stateChanged) self._chk_pt.stateChanged.connect(self.stateChanged) self._chk_et.stateChanged.connect(self.stateChanged) self._chk_errorbar.stateChanged.connect(self.stateChanged) return layout
class ActualFakeActuator(object): def __init__(self, callback=None): self.callback = callback self.app = QApplication(sys.argv) self.vlayout = QVBoxLayout() self.button = QPushButton('light') self.button.pressed.connect(self._button_callback) self.button.setCheckable(True) self.button.setChecked(True) self.button.setStyleSheet('background-color: white') self.vlayout.addWidget(self.button) self.slider = QSlider() self.slider.setOrientation(Qt.Horizontal) self.vlayout.addWidget(self.slider) self.dial = QDial() self.dial.setNotchesVisible(True) self.dial.setWrapping(True) self.vlayout.addWidget(self.dial) self.quit = QPushButton('Quit') self.quit.clicked.connect(self.app.quit) self.vlayout.addWidget(self.quit) self.group = QGroupBox('Fake Actuator') self.group.setLayout(self.vlayout) def _button_callback(self): if self.button.isChecked(): self.button.setStyleSheet('background-color: red') else: self.button.setStyleSheet('background-color: white') def light_on(self): return self.button.isChecked() def toggle_light(self, on): self.button.setChecked(on) def volume(self): return self.slider.value() def set_volume(self, value): self.slider.setValue(value) def position(self): return self.dial.value() def set_position(self, value): self.dial.setValue(value) def run(self): self.group.show() self.app.exec_()
def create_groupbox_layout(self, is_vertical, parent, label, owner): """ Returns a new GUI toolkit neutral vertical layout manager for a groupbox. """ gb = QGroupBox(label, check_parent(parent)) gb.owner = owner bl = self.create_box_layout(is_vertical) gb.setLayout(bl()) return (control_adapter_for(gb), bl)
class ElastixMainDialog(QDialog): """ ElastixMainDialog """ def __init__(self, parent): super(ElastixMainDialog, self).__init__(parent) self.transformation = None self.transformations = AppResources.elastixTemplates() self.radioButtons = [] for transformation in self.transformations: self.radioButtons.append(QRadioButton(transformation.name)) self.radioButtons.append(QRadioButton("Load custom parameter file...")) self.radioButtons[0].setChecked(True) self.nextButton = QPushButton("Next") self.nextButton.clicked.connect(self.next) self.cancelButton = QPushButton("Cancel") self.cancelButton.clicked.connect(self.cancel) groupLayout = QVBoxLayout() for radioButton in self.radioButtons: groupLayout.addWidget(radioButton) self.groupBox = QGroupBox("Choose parameter file") self.groupBox.setLayout(groupLayout) self.setModal(True) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.groupBox, 0, 0, 1, 2) layout.addWidget(self.cancelButton, 1, 0) layout.addWidget(self.nextButton, 1, 1) self.setLayout(layout) @Slot() def next(self): selectedIndex = 0 for index in range(len(self.radioButtons)): radioButton = self.radioButtons[index] if radioButton.isChecked(): selectedIndex = index if selectedIndex == len(self.transformations): # load custom transformation self.accept() else: # load choosen transformation self.transformation = self.transformations[selectedIndex] self.accept() @Slot() def cancel(self): self.reject()
class PickerTypeDialog(QDialog): """ PickerTypeDialog """ def __init__(self, parent): super(PickerTypeDialog, self).__init__(parent) self.pickerType = None self.pickerTypes = [(SurfaceType, "Surface picker"), (TwoStepType, "Two step picker")] self.radioButtons = [] for picker in self.pickerTypes: self.radioButtons.append(QRadioButton(picker[1])) # self.radioButtons[0].setChecked(True) self.buttonGroup = QButtonGroup() ind = 0 for button in self.radioButtons: self.buttonGroup.addButton(button) self.buttonGroup.setId(button, ind) ind += 1 self.nextButton = QPushButton("Choose") self.nextButton.clicked.connect(self.choose) self.cancelButton = QPushButton("Cancel") self.cancelButton.clicked.connect(self.cancel) groupLayout = QVBoxLayout() for radioButton in self.radioButtons: groupLayout.addWidget(radioButton) self.groupBox = QGroupBox("Choose picker type:") self.groupBox.setLayout(groupLayout) self.setModal(True) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.groupBox, 0, 0, 1, 2) layout.addWidget(self.cancelButton, 1, 0) layout.addWidget(self.nextButton, 1, 1) self.setLayout(layout) @Slot() def choose(self): selectedIndex = self.buttonGroup.checkedId() if selectedIndex >= 0: # load choosen picker type self.pickerType = self.pickerTypes[selectedIndex][0] self.accept() @Slot() def cancel(self): self.reject()
def __init__(self, parent=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") main_layout = QVBoxLayout() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) settings = QSettings() db_group = QGroupBox("Database") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("File"), 0, 0) text = settings.value('DB/File') self.file = QLineEdit(text) self.file.setText(text) grid_layout.addWidget(self.file, 0, 1) browse = QPushButton("Browse") browse.clicked.connect(self.browse) grid_layout.addWidget(browse, 0, 2) db_group.setLayout(grid_layout) main_layout.addWidget(db_group) ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000 ") smtp_group = QGroupBox("SMTP") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) text = settings.value('SMTP/Server') self.smtp_server = QLineEdit(text) self.smtp_server.setText(text) grid_layout.addWidget(self.smtp_server, 0, 1) smtp_group.setLayout(grid_layout) main_layout.addWidget(smtp_group) self.http_proxy = QGroupBox("HTTP Proxy") self.http_proxy.setCheckable(True) self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled'))) grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) self.http_proxy_ip = QLineEdit() self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP')) self.http_proxy_ip.setMinimumWidth(ip_width) grid_layout.addWidget(self.http_proxy_ip, 0, 1) grid_layout.setColumnStretch(0, 1) self.http_proxy.setLayout(grid_layout) main_layout.addWidget(self.http_proxy) main_layout.addWidget(buttonBox) self.setLayout(main_layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, parent=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") main_layout = QVBoxLayout() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel) settings = QSettings() db_group = QGroupBox("Database") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("File"),0,0) text = settings.value('DB/File') self.file = QLineEdit(text) self.file.setText(text) grid_layout.addWidget(self.file,0,1) browse = QPushButton("Browse") browse.clicked.connect(self.browse) grid_layout.addWidget(browse,0,2) db_group.setLayout(grid_layout) main_layout.addWidget(db_group) ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000 ") smtp_group = QGroupBox("SMTP") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"),0,0) text = settings.value('SMTP/Server') self.smtp_server = QLineEdit(text) self.smtp_server.setText(text) grid_layout.addWidget(self.smtp_server,0,1) smtp_group.setLayout(grid_layout) main_layout.addWidget(smtp_group) self.http_proxy = QGroupBox("HTTP Proxy") self.http_proxy.setCheckable(True) self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled'))) grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"),0,0) self.http_proxy_ip = QLineEdit() self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP')) self.http_proxy_ip.setMinimumWidth(ip_width) grid_layout.addWidget(self.http_proxy_ip,0,1) grid_layout.setColumnStretch(0,1) self.http_proxy.setLayout(grid_layout) main_layout.addWidget(self.http_proxy) main_layout.addWidget(buttonBox) self.setLayout(main_layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def initUI(self): grp = QGroupBox('Anim Munge') grplay = QGridLayout() self.bf1mode = QCheckBox() grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1) grplay.addWidget(self.bf1mode, 0, 2) grplay.addWidget(QLabel('<b>Input</b>'), 1, 1) grplay.addWidget(QLabel('<b>Output</b>'), 1, 3) self.infiles = QListWidget() self.infiles.setMinimumWidth(150) self.infiles.addItems([os.path.basename(item) for item in self.files]) grplay.addWidget(self.infiles, 2, 1, 1, 2) self.outfiles = QListWidget() self.outfiles.setMinimumWidth(150) grplay.addWidget(self.outfiles, 2, 3, 1, 2) self.add_params = QLineEdit() self.add_params.setText('Additional Params') self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5') grplay.addWidget(self.add_params, 0, 3, 1, 2) self.statlabel = QLabel('<b>AnimMunger</b>') grplay.addWidget(self.statlabel, 4, 1, 1, 1) self.animname = QLineEdit() self.animname.setText('AnimName') self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.') grplay.addWidget(self.animname, 3, 1) self.type_box = QComboBox() self.type_box.addItems(self.types) self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.') grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2) grplay.addWidget(self.type_box, 3, 3, 1, 2) munge_btn = QPushButton('Munge') munge_btn.clicked.connect(self.munge) munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.') grplay.addWidget(munge_btn, 4, 2) save_out = QPushButton('Save') save_out.clicked.connect(self.save) save_out.setToolTip('<b>Save.</b> Saves the output files.') grplay.addWidget(save_out, 4, 3) cancel_btn = QPushButton('Cancel') cancel_btn.clicked.connect(self.cancel) cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.') grplay.addWidget(cancel_btn, 4, 4) grp.setLayout(grplay) mainlay = QVBoxLayout() mainlay.addWidget(grp) self.setLayout(mainlay) self.setGeometry(340, 340, 320, 300) self.setWindowTitle('MSH Suite - Animation Munge') self.show()
def main(): app = QApplication(sys.argv) mainwindow = QMainWindow() group = QGroupBox('Some options', mainwindow) group.setLayout(QVBoxLayout(group)) mainwindow.setCentralWidget(group) boxes = FoldableCheckBoxes(group) for group_name, title, items in GROUPS: boxes.addGroup(group_name, title) for name, title in items: boxes.addOption(group_name, name, title) group.layout().addWidget(boxes) mainwindow.show() app.exec_()
def setupUI(self): paneLayout = QHBoxLayout() paneLayout.setContentsMargins(0, 0, 0, 0) leftPane = QFrame() leftPane.setObjectName("leftPane") leftPaneLayout = QVBoxLayout() leftPaneLayout.setContentsMargins(20, 20, 20, 10) heading = QLabel("Select Employee: ") heading.setObjectName("heading") leftPaneLayout.addWidget(heading) leftPaneLayout.addSpacing(10) form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) leftPaneLayout.addLayout(form1) leftPaneLayout.addStretch() leftPane.setLayout(leftPaneLayout) layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setContentsMargins(10, 10, 10, 30) form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) paneLayout.addWidget(leftPane) paneLayout.addLayout(layout) self.setLayout(paneLayout)
def setupTopGroup(self): topGroup = QGroupBox("Simulation Results") self.resultsPathLineEdit = SimpleOption('resultsPath','Results Path','/home/thomas/Dropbox/Keio/research/results/') topGroupLayout = QVBoxLayout() topGroupLayout.setSpacing(0) topGroupLayout.setAlignment(Qt.AlignTop) topGroupLayout.addWidget(self.resultsPathLineEdit) self.loadResultsLabel = QLabel() self.loadResultsLabel.setAlignment(Qt.AlignHCenter) topGroupLayout.addWidget(self.loadResultsLabel) self.loadResultsButton = QPushButton("Load the results") self.loadResultsButton.clicked.connect(self.loadResults) topGroupLayout.addWidget(self.loadResultsButton) topGroup.setLayout(topGroupLayout) self.topLeftLayout.addWidget(topGroup)
def __init__(self, parent=None): super(Hatcher, self).__init__(parent) browser_container = BrowserContainer() record_table = RecordTable(browser_container._browser) layout = QGridLayout() layout_table = QVBoxLayout() layout_table.addWidget(record_table) groupbox_table = QGroupBox() groupbox_table.setTitle(self.tr("Record table")) groupbox_table.setLayout(layout_table) row = 0; col = 0; layout.addWidget(browser_container, row, col, 1, 4) row += 1; col += 1 layout.addWidget(groupbox_table, row, col, 1, 2) self.setLayout(layout)
def __init__(self,parent=None): super(QtReducePreferencesToolBar,self).__init__(parent) settings = QSettings() toolBarGroup = QGroupBox(self.tr("Toolbar")) self.iconSetCombo = QtReduceComboBox() iDbKeys = QtReduceIconSets().db.keys() iDbKeys.sort() self.iconSetCombo.addItems(iDbKeys) settings.setValue("toolbar/iconset","Oxygen") # Hack traceLogger.debug("toolbar/iconset=%s" % settings.value("toolbar/iconset")) self.iconSetCombo.setCurrentIndex( self.iconSetCombo.findText( settings.value("toolbar/iconset",QtReduceDefaults.ICONSET))) self.iconSizeCombo = QtReduceIconSizeComboBox() self.iconSizeCombo.addItems(["16","22","32"]) self.iconSizeCombo.setCurrentIndex( self.iconSizeCombo.findText( str(settings.value("toolbar/iconsize", QtReduceDefaults.ICONSIZE)))) self.showCombo = QtReduceComboBox() self.showCombo.addItems([self.tr("Symbol and Text"), self.tr("Only Symbol"), self.tr("Only Text")]) self.showCombo.setCurrentIndex(self.showCombo.findText( settings.value("toolbar/buttonstyle", self.tr(QtReduceDefaults.BUTTONSTYLE)))) toolBarLayout = QFormLayout() # toolBarLayout.addRow(self.tr("Symbol Set"),self.iconSetCombo) toolBarLayout.addRow(self.tr("Symbol Size"),self.iconSizeCombo) toolBarLayout.addRow(self.tr("Show"),self.showCombo) toolBarGroup.setLayout(toolBarLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(toolBarGroup) self.setLayout(mainLayout)
def setupFilterGroup(self): filterGroup = QGroupBox('Filter the results') filterGroupLayout = QVBoxLayout() filterGroupLayout.setSpacing(0) filterGroupLayout.setAlignment(Qt.AlignTop) # Distribution Model self.filterDistribution = SimpleComboboxOption('dis','Speed Distribution Model',3, True, 'Uniform','Exponential','Normal','Log Normal') filterGroupLayout.addWidget(self.filterDistribution) self.filterDistribution.setVisible(False) # Number of results per point self.filterNb = SimpleSpinOption('simuNbMin', 'Minimum results for a given setting', 10, integer=True, checkable=True) self.filterNb.checkBox.setChecked(True) filterGroupLayout.addWidget(self.filterNb) # Filter the date dateWidget = QWidget() dateWidget.setLayout(QHBoxLayout()) self.filterDate = QCheckBox('After') self.filterDate.setChecked(QSettings().value('filterDate','0')=='1') dateWidget.layout().addWidget(self.filterDate) self.filterDateYear = QComboBox() for m in xrange(2010,2012): self.filterDateYear.addItem(str(m)) self.filterDateYear.setCurrentIndex(int(QSettings().value('dateYear', 1))) dateWidget.layout().addWidget(self.filterDateYear) dateWidget.layout().addWidget(QLabel('Year')) self.filterDateMonth = QComboBox() for m in xrange(1,13): self.filterDateMonth.addItem(str(m)) self.filterDateMonth.setCurrentIndex(int(QSettings().value('dateMonth', 4))) dateWidget.layout().addWidget(self.filterDateMonth) dateWidget.layout().addWidget(QLabel('Month')) self.filterDateDay = QComboBox() for d in xrange(1,32): self.filterDateDay.addItem(str(d)) self.filterDateDay.setCurrentIndex(int(QSettings().value('dateDay', 0))) dateWidget.layout().addWidget(self.filterDateDay) dateWidget.layout().addWidget(QLabel('Day')) filterGroupLayout.addWidget(dateWidget) filterGroup.setLayout(filterGroupLayout) self.topLeftLayout.addWidget(filterGroup) # Filter the scenario self.filterScenar = SimpleComboboxOption('scenar','Scenario',1, True, 'vanet-highway-test-thomas','vanet-highway-scenario2') filterGroupLayout.addWidget(self.filterScenar) # Filter gap self.filterGap = SimpleSpinOption('avgdistanalyze','Average Distance (m)',100, checkable=True) filterGroupLayout.addWidget(self.filterGap)
def __init__(self, parent=None): super(Hatcher, self).__init__(parent) browser_container = BrowserContainer() record_table = RecordTable(browser_container._browser) layout = QGridLayout() layout_table = QVBoxLayout() layout_table.addWidget(record_table) groupbox_table = QGroupBox() groupbox_table.setTitle(self.tr("Record table")) groupbox_table.setLayout(layout_table) row = 0 col = 0 layout.addWidget(browser_container, row, col, 1, 4) row += 1 col += 1 layout.addWidget(groupbox_table, row, col, 1, 2) self.setLayout(layout)
def setup_advanced_storage_group(self): """ Setup the 'Storage' group in the 'Advanced' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Storage') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) path = Config.get('WEB_SOURCE_STORE', '') self.message_storage_edit = QLineEdit(path) self.message_storage_edit.textChanged.connect(self.update_message_storage) layout.addRow('Message Storage Path', self.message_storage_edit) group.setLayout(layout) return group
def group(title='', *widgets): """ Creates a groupBox with the widgets inside :param title: group's title :param widgets: widgets you wqnt to qdd :type widgets: tuple[QWidget] :return: the group box :rtype: QGroupBox """ g = QGroupBox() g.setTitle(title) l = QVBoxLayout() apply_layout(l, *widgets) l.setContentsMargins(4, 4, 4, 4) g.setLayout(l) return g
def setup_advanced_server_group(self): """ Setup the 'Server' group in the 'Advanced' tab. Returns: -------- A QGroupBox widget """ group = QGroupBox('Server') layout = QFormLayout() layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) self.message_url_edit = QLineEdit(Config.get('WS_HOST', '')) self.message_url_edit.textChanged.connect(self.update_message_url) layout.addRow('Messages API URL', self.message_url_edit) group.setLayout(layout) return group
def buildFilterListView(self): """Creates the QListView that contains all of the basic Clause objects. """ groupBox = QGroupBox("Clauses") layout = QVBoxLayout(groupBox) self.list_view = QListView(groupBox) self.list_view.setModel(self.clause_model) layout.addWidget(self.list_view) layout.addItem(QSpacerItem(5,5)) self.delButton = QPushButton("Remove Selected Clause") self.delButton.clicked.connect(self.deleteClause) layout.addWidget(self.delButton) groupBox.setLayout(layout) return groupBox
def get_frame(self): # Info stuff. self.infos = {} infogrp = QGroupBox('Scene Info') grdlay = QGridLayout() grdlay.addWidget(QLabel('<b>Name</b>'), 0, 0) namebox = QLineEdit() self.infos['name'] = namebox namebox.setText(self.info.name) rangebox1 = QSpinBox() rangebox1.setMinimum(0) rangebox1.setMaximum(1000) self.infos['rangestart'] = rangebox1 rangebox1.setValue(self.info.frame_range[0]) rangebox2 = QSpinBox() rangebox2.setMinimum(0) rangebox2.setMaximum(1000) self.infos['rangeend'] = rangebox2 rangebox2.setValue(self.info.frame_range[1]) fpsbox = QDoubleSpinBox() self.infos['fps'] = fpsbox fpsbox.setValue(self.info.fps) bbox_btn = QPushButton('Bounding Box') bbox_btn.clicked.connect(self.edit_bbox) grdlay.addWidget(namebox, 0, 1) grdlay.addWidget(QLabel('<b>StartFrame</b>'), 1, 0) grdlay.addWidget(rangebox1, 1, 1) grdlay.addWidget(QLabel('<b>EndFrame</b>'), 1, 2) grdlay.addWidget(fpsbox, 0, 3) grdlay.addWidget(rangebox2, 1, 3) grdlay.addWidget(QLabel('<b>FPS</b>'), 0, 2) grdlay.addWidget(bbox_btn, 2, 0) grplay = QVBoxLayout() grplay.addLayout(grdlay) #grplay.addStretch() infogrp.setLayout(grplay) return infogrp
def setUpUi(self): # Main Layout self.main_layout = QVBoxLayout(self) # CheckBoxes self.checkbox_ui = {} # チェックボックスを生成 for key, names in self.ui_config.items(): checkboxes = [] for name in names: cb = QCheckBox(name, self) # 後で呼び出し元を調べるためにObjectNameに名前を格納 cb.setObjectName(name) checkboxes.append(cb) # UIオブジェクトが格納された辞書 self.checkbox_ui[key] = checkboxes # GUIをレイアウトで整列 # 毎回辞書から呼ばれる順番が変わるのでソート(重要) for key, uiobjs in sorted(self.checkbox_ui.items(), key=lambda x: x[0]): groupBox = QGroupBox(key, self) layout = QHBoxLayout() for uiobj in uiobjs: layout.addWidget(uiobj) layout.addStretch(3) groupBox.setLayout(layout) self.main_layout.addWidget(groupBox) # Button Box self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.main_layout.addWidget(self.buttonBox) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def layoutWidgets(self): layout = QVBoxLayout() hbox = QHBoxLayout() hbox.addStretch() hbox.addWidget(self.formatPanel) layout.addLayout(hbox) seeGroup = QGroupBox("See") form = QFormLayout() form.addRow(self.seeLabel, self.seeTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seePrefixTextEdit) hbox.addWidget(self.seeSepLabel) hbox.addWidget(self.seeSepTextEdit) hbox.addWidget(self.seeSuffixLabel) hbox.addWidget(self.seeSuffixTextEdit) form.addRow(self.seePrefixLabel, hbox) seeGroup.setLayout(form) layout.addWidget(seeGroup) alsoGroup = QGroupBox("See Also") form = QFormLayout() form.addRow(self.seeAlsoLabel, self.seeAlsoTextEdit) hbox = QHBoxLayout() hbox.addWidget(self.seeAlsoPrefixTextEdit) hbox.addWidget(self.seeAlsoSepLabel) hbox.addWidget(self.seeAlsoSepTextEdit) hbox.addWidget(self.seeAlsoSuffixLabel) hbox.addWidget(self.seeAlsoSuffixTextEdit) form.addRow(self.seeAlsoPrefixLabel, hbox) form.addRow(self.seeAlsoPositionLabel, self.seeAlsoPositionComboBox) alsoGroup.setLayout(form) layout.addWidget(alsoGroup) form = QFormLayout() form.addRow(self.xrefToSubentryLabel, self.xrefToSubentryComboBox) form.addRow(self.genericConjunctionLabel, self.genericConjunctionTextEdit) layout.addLayout(form) layout.addStretch(2) self.setLayout(layout)
def _buildGUI(self): ''' Construct the GUI widgets and layouts. ''' centerWidget = QWidget() self._window.setCentralWidget(centerWidget) worldLayout = QHBoxLayout() worldLayout.addWidget(self._worldWidget) grpBx = QGroupBox("2D World") grpBx.setLayout(worldLayout) grpBx.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) ctrlPan = self._buildControlPanel() layout = QHBoxLayout() layout.addWidget(ctrlPan) layout.addWidget(grpBx) layout.setAlignment(ctrlPan, Qt.AlignLeft | Qt.AlignTop) centerWidget.setLayout(layout)
def __init__(self, *args, **kwargs): super(Widget_TypeAttributeList, self).__init__(*args, **kwargs) self.installEventFilter(self) mainLayout = QVBoxLayout(self) mainLayout.setContentsMargins(0, 0, 0, 5) groupBox = QGroupBox("Search Attribute Types") groupBoxLayout = QVBoxLayout() groupBox.setStyleSheet("font-size:12px") groupBox.setLayout(groupBoxLayout) groupBoxLayout.setContentsMargins(0, 0, 0, 0) scrollArea = QScrollArea() scrollArea.setStyleSheet("font-size:11px") scrollAreaWidget = QWidget() scrollAreaLayout = QVBoxLayout(scrollAreaWidget) scrollArea.setWidgetResizable(True) scrollArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Ignored) scrollArea.setWidget(scrollAreaWidget) scrollAreaLayout.setContentsMargins(5, 0, 5, 0) scrollArea.resize(scrollArea.sizeHint()) groupBoxLayout.addWidget(scrollArea) self.get_csv_form_google_spreadsheets(Widget_TypeAttributeList.url, Widget_TypeAttributeList.csv) dict_list = self.get_dictList_from_csvPath( Widget_TypeAttributeList.csv) self.w_typeAttrs = [] for dict_data in dict_list: w_typeAttr = Widget_TypeAttribute(attr_name=dict_data['attr_name'], type_node=dict_data['type_node']) scrollAreaLayout.addWidget(w_typeAttr) self.w_typeAttrs.append(w_typeAttr) empty = QLabel() empty.setMinimumHeight(0) scrollAreaLayout.addWidget(empty) mainLayout.addWidget(groupBox) self.resize(0, 100)
def getParameterWidget(self): self.labelFixedOpacity = QLabel("Fixed:") self.labelFixedOpacity.setAlignment(Qt.AlignRight) self.labelMovingOpacity = QLabel("Moving:") self.labelMovingOpacity.setAlignment(Qt.AlignRight) self.sliderFixedOpacity = QSlider(Qt.Horizontal) self.sliderFixedOpacity.setValue( pow(self.fixedOpacity, 1.0 / 3.0) * 100.0) self.sliderMovingOpacity = QSlider(Qt.Horizontal) self.sliderMovingOpacity.setValue( pow(self.movingOpacity, 1.0 / 3.0) * 100.0) self.blendTypeComboBox = QComboBox() self.blendTypeComboBox.addItem("Default additive blend") self.blendTypeComboBox.addItem("Difference blend") self.blendTypeComboBox.currentIndexChanged.connect(self.valueChanged) # Be sure to connect after the values are set... self.sliderFixedOpacity.valueChanged.connect(self.valueChanged) self.sliderMovingOpacity.valueChanged.connect(self.valueChanged) groupLayout = QGridLayout() groupLayout.setAlignment(Qt.AlignTop) groupLayout.addWidget(self.labelFixedOpacity, 0, 0) groupLayout.addWidget(self.sliderFixedOpacity, 0, 1) groupLayout.addWidget(self.labelMovingOpacity, 1, 0) groupLayout.addWidget(self.sliderMovingOpacity, 1, 1) groupBox = QGroupBox() groupBox.setTitle("Opacity:") groupBox.setLayout(groupLayout) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(groupBox) widget = QWidget() widget.setLayout(layout) return widget
def _buildRenderingOptions(self): ''' Creates the sub-panel containing control widgets for setting options in how the world is rendered on the GUI. ''' self._openChk = QCheckBox("Active Cells") self._visitedChk = QCheckBox("Visited Cells") self._pathChk = QCheckBox("Draw Path") self._costChk = QCheckBox("Draw Estimated Costs") pal = self._openChk.palette() pal.setColor(QPalette.WindowText, Qt.green) self._openChk.setPalette(pal) pal = self._visitedChk.palette() pal.setColor(QPalette.WindowText, Qt.cyan) self._visitedChk.setPalette(pal) pal = self._pathChk.palette() pal.setColor(QPalette.WindowText, Qt.red) self._pathChk.setPalette(pal) self._visitedChk.setChecked(True) self._pathChk.setChecked(True) self._costChk.setChecked(True) self._openChk.stateChanged.connect(self._renderingOptionChanged) self._visitedChk.stateChanged.connect(self._renderingOptionChanged) self._pathChk.stateChanged.connect(self._renderingOptionChanged) self._costChk.stateChanged.connect(self._renderingOptionChanged) layout = QVBoxLayout() layout.addWidget(self._openChk) layout.addWidget(self._visitedChk) layout.addWidget(self._pathChk) layout.addWidget(self._costChk) grpBx = QGroupBox("Rendering Options") grpBx.setLayout(layout) grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) return grpBx
def __init__(self): super(window, self).__init__() self.resize(1024,720) self.centralWidget = QWidget(self) self.setWindowTitle('Plotting Points (Google Maps)') self.layout = QHBoxLayout(self.centralWidget) self.frame = QFrame(self.centralWidget) self.frameLayout = QVBoxLayout(self.frame) self.web = QtWebKit.QWebView() group_left = QGroupBox('Data Preparation') groupLeft_layout = QGridLayout() self.openButton = QPushButton("Open file") self.openButton.clicked.connect(self.openfile) self.optUTM = QCheckBox('UTM Data') groupLeft_layout.addWidget(self.optUTM,0,0) groupLeft_layout.addWidget(self.openButton,1,0) groupLeft_layout.setRowStretch(2,1) group_left.setLayout(groupLeft_layout) self.frameLayout.addWidget(self.web) self.layout.addWidget(group_left) self.layout.addWidget(self.frame) self.layout.setStretch(1,1) self.setCentralWidget(self.centralWidget) url = 'http://maps.google.com' self.showMap(url)
def finish_group(): # Finish the existing group debug_print('Finishing', current_group) # The widget that holds this group's controls controls_widget = QWidget() controls_widget.setLayout(group_layout) controls_widget.setVisible(False) # The group box, which contains the label to toggle the controls# # and the controls themselves group_box_layout = QVBoxLayout() group_box_layout.addWidget( ToggleWidgetLabel(current_group, controls_widget)) group_box_layout.addWidget(controls_widget) group_box = QGroupBox() group_box.setLayout(group_box_layout) # Add the group box to the main layout self._main_layout.addRow(group_box) #self._main_layout.addWidget(group_box) groups[current_group] = group_box
def buildModuleGroupBox(self): """Layout/construct the ModuleScene UI for this tab.""" groupBox = QGroupBox("Module Policy") layout = QVBoxLayout() # agent.propagate_module_scenes self.module_propagate = QCheckBox("Propagate module scene information " + "to other modules.") self.module_propagate.setChecked(self.agent.propagate_module_scenes) self.module_propagate.stateChanged.connect(self.modulePropagateChanged) # We only allow this change if the parent does not propagate if self.agent.parent().propagate_module_scenes: self.module_propagate.setDisabled(True) # agent.apply_module_scenes self.module_applyScene = QCheckBox("Apply module scene information " + "from other modules.") self.module_applyScene.setChecked(self.agent.apply_module_scenes) self.module_applyScene.stateChanged.connect(self.moduleApplyChanged) layout.addWidget(self.module_applyScene) layout.addItem(QSpacerItem(5, 5)) layout.addWidget(self.module_propagate) groupBox.setLayout(layout) return groupBox
class ActualFakeSensor(object): def __init__(self, callback=None): self.callback = callback self.app = QApplication(sys.argv) self.layout = QVBoxLayout() self.dial = QDial() self.dial.valueChanged.connect(self.dial_callback) self.dial.setNotchesVisible(True) self.dial.setWrapping(True) self.layout.addWidget(self.dial) self.quit = QPushButton('Quit') self.quit.clicked.connect(self.app.quit) self.layout.addWidget(self.quit) self.group = QGroupBox('Fake Sensor') self.group.setLayout(self.layout) def dial_callback(self, value): if self.callback: self.callback(self.value()) def register_callback(self, callback): self.callback = callback def value(self): return self.dial.value() def set_value(self, value): self.dial.setValue(value) def run(self): self.group.show() self.app.exec_()
def setupUI(self): layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) datelayout = QHBoxLayout() datelayout.addWidget(QLabel("Salary for month of ")) datelayout.addWidget(self.month) datelayout.addWidget(self.year) datelayout.addStretch() layout.addLayout(datelayout) form = QFormLayout() form.setSpacing(10) form.addRow(QLabel("Name"), self.name) form.addRow(QLabel("ID No."), self.id) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) infoGroup = QGroupBox("Basic Info") infoGroup.setLayout(form) layout.addWidget(infoGroup) leftForm = QFormLayout() leftForm.addRow(QLabel("Dearness Allowance"), self.da_percent) leftForm.addRow(QLabel("Housing Rent Allowance"), self.hra_percent) leftForm.addRow(QLabel("Transport Allowance"), self.ta_percent) leftGroup = QGroupBox("Allowances") leftGroup.setLayout(leftForm) rightForm = QFormLayout() rightForm.addRow(QLabel("Income Tax"), self.it_percent) rightForm.addRow(QLabel("Profession Tax"), self.pt_percent) rightGroup = QGroupBox("Deductions") rightGroup.setLayout(rightForm) table = QHBoxLayout() table.addWidget(leftGroup) table.addWidget(rightGroup) layout.addLayout(table) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnCalculate) layout.addLayout(bttnLayout) self.setLayout(layout)
def __init__(self): ''' Constructor ''' super(MyWidget2, self).__init__() self.resize(100, 100) mainLayout = QVBoxLayout() hbox1 = QHBoxLayout() hbox2 = QHBoxLayout() hbox3 = QHBoxLayout() korisnik = QGroupBox() btnRegistracijaKorsnika = QPushButton("Registracija korisnika") btnBrisanjeKorisnika = QPushButton("Brisanje korisnika") btnIzmenaKorisnika = QPushButton("Izmena korisnika") hbox1.addWidget(btnRegistracijaKorsnika) hbox1.addWidget(btnBrisanjeKorisnika) hbox1.addWidget(btnIzmenaKorisnika) korisnik.setLayout(hbox1) deonica = QGroupBox() btnDodavanjeDeonice = QPushButton("Dodavanje deonice") btnBrisanjeDeonice = QPushButton("Brisanje deonice") btnIzmenaDeonice = QPushButton("Izmena deonice") hbox2.addWidget(btnDodavanjeDeonice) hbox2.addWidget(btnBrisanjeDeonice) hbox2.addWidget(btnIzmenaDeonice) deonica.setLayout(hbox2) naplatnoMesto = QGroupBox() btnDodavanjeNapatnogMesta = QPushButton("Dodavanje naplatnog mesta") btnBrisanjeNaplatnihMesta = QPushButton("Brisanje naplatnog mesta") btnIzmenaNaplatnihMesta = QPushButton("Izmena naplatnog mesta") hbox3.addWidget(btnDodavanjeNapatnogMesta) hbox3.addWidget(btnBrisanjeNaplatnihMesta) hbox3.addWidget(btnIzmenaNaplatnihMesta) naplatnoMesto.setLayout(hbox3) mainLayout.addWidget(korisnik) mainLayout.addWidget(deonica) mainLayout.addWidget(naplatnoMesto) self.setLayout(mainLayout)
def createMainWidget(self): """ TOWRITE :return: TOWRITE :rtype: QScrollArea """ widget = QWidget(self) # Misc groupBoxMisc = QGroupBox(self.tr("General Information"), widget) labelStitchesTotal = QLabel(self.tr("Total Stitches:"), self) labelStitchesReal = QLabel(self.tr("Real Stitches:"), self) labelStitchesJump = QLabel(self.tr("Jump Stitches:"), self) labelStitchesTrim = QLabel(self.tr("Trim Stitches:"), self) labelColorTotal = QLabel(self.tr("Total Colors:"), self) labelColorChanges = QLabel(self.tr("Color Changes:"), self) labelRectLeft = QLabel(self.tr("Left:"), self) labelRectTop = QLabel(self.tr("Top:"), self) labelRectRight = QLabel(self.tr("Right:"), self) labelRectBottom = QLabel(self.tr("Bottom:"), self) labelRectWidth = QLabel(self.tr("Width:"), self) labelRectHeight = QLabel(self.tr("Height:"), self) fieldStitchesTotal = QLabel(u'%s' % (self.stitchesTotal), self) fieldStitchesReal = QLabel(u'%s' % (self.stitchesReal), self) fieldStitchesJump = QLabel(u'%s' % (self.stitchesJump), self) fieldStitchesTrim = QLabel(u'%s' % (self.stitchesTrim), self) fieldColorTotal = QLabel(u'%s' % (self.colorTotal), self) fieldColorChanges = QLabel(u'%s' % (self.colorChanges), self) fieldRectLeft = QLabel(u'%s' % (str(self.boundingRect.left()) + " mm"), self) fieldRectTop = QLabel(u'%s' % (str(self.boundingRect.top()) + " mm"), self) fieldRectRight = QLabel( u'%s' % (str(self.boundingRect.right()) + " mm"), self) fieldRectBottom = QLabel( u'%s' % (str(self.boundingRect.bottom()) + " mm"), self) fieldRectWidth = QLabel( u'%s' % (str(self.boundingRect.width()) + " mm"), self) fieldRectHeight = QLabel( u'%s' % (str(self.boundingRect.height()) + " mm"), self) gridLayoutMisc = QGridLayout(groupBoxMisc) gridLayoutMisc.addWidget(labelStitchesTotal, 0, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelStitchesReal, 1, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelStitchesJump, 2, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelStitchesTrim, 3, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelColorTotal, 4, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelColorChanges, 5, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectLeft, 6, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectTop, 7, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectRight, 8, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectBottom, 9, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectWidth, 10, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(labelRectHeight, 11, 0, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldStitchesTotal, 0, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldStitchesReal, 1, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldStitchesJump, 2, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldStitchesTrim, 3, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldColorTotal, 4, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldColorChanges, 5, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectLeft, 6, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectTop, 7, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectRight, 8, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectBottom, 9, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectWidth, 10, 1, Qt.AlignLeft) gridLayoutMisc.addWidget(fieldRectHeight, 11, 1, Qt.AlignLeft) gridLayoutMisc.setColumnStretch(1, 1) groupBoxMisc.setLayout(gridLayoutMisc) # TODO: Color Histogram # Stitch Distribution # groupBoxDist = QGroupBox(self.tr("Stitch Distribution"), widget) # TODO: Stitch Distribution Histogram # Widget Layout vboxLayoutMain = QVBoxLayout(widget) vboxLayoutMain.addWidget(groupBoxMisc) # vboxLayoutMain.addWidget(groupBoxDist) vboxLayoutMain.addStretch(1) widget.setLayout(vboxLayoutMain) scrollArea = QScrollArea(self) scrollArea.setWidgetResizable(True) scrollArea.setWidget(widget) return scrollArea
class Panel(QWidget): def __init__(self, state, config, parent): super().__init__(parent) self.state = state self.config = config self.form = parent self.createWidgets() self.layoutWidgets() self.createConnections() def createWidgets(self): settings = QSettings() self.txtGroupBox = QGroupBox("Plain Text Format (.txt)") self.indentLabel = QLabel("&Indent") self.indentComboBox = QComboBox() self.indentLabel.setBuddy(self.indentComboBox) oldIndent = IndentKind.TAB oldIndent = self.config.get(Gconf.Key.Indent, oldIndent) index = -1 for i, indent in enumerate(IndentKind): text = indent.name.replace("_", " ").title() self.indentComboBox.addItem(text, indent.value) if indent is oldIndent: index = i self.indentComboBox.setCurrentIndex(index) self.form.tooltips.append((self.indentComboBox, """\ <p><b>Indent</b></p> <p>The indentation to use when outputting an indented-style index in plain text format for each level of indentation.</p>""")) self.rtfGroupBox = QGroupBox("Rich Text Format (.rtf)") self.rtfIndentLabel = QLabel("I&ndent") self.rtfIndentComboBox = QComboBox() self.rtfIndentLabel.setBuddy(self.rtfIndentComboBox) oldIndent = IndentKind(int(settings.value(Gopt.Key.IndentRTF, Gopt.Default.IndentRTF))) index = -1 for i, indent in enumerate(IndentKind): text = ("Indent" if i == 0 else indent.name.replace("_", " ").title()) self.rtfIndentComboBox.addItem(text, indent.value) if indent is oldIndent: index = i self.rtfIndentComboBox.setCurrentIndex(index) self.form.tooltips.append((self.rtfIndentComboBox, """\ <p><b>Indent</b></p> <p>The indentation to use when outputting an indented-style index in rich text format for each level of indentation.</p>""")) self.pdfGroupBox = QGroupBox("Portable Document Format (.pdf)") self.paperSizeLabel = QLabel("Paper Size") self.letterRadioButton = QRadioButton("&Letter") self.a4RadioButton = QRadioButton("&A4") size = PaperSizeKind(int(settings.value(Gopt.Key.PaperSize, Gopt.Default.PaperSize))) if size is PaperSizeKind.LETTER: self.letterRadioButton.setChecked(True) else: self.a4RadioButton.setChecked(True) self.form.tooltips.append((self.letterRadioButton, """\ <p><b>Paper Size, Letter</b></p> <p>If checked, when outputting a PDF of the index, US Letter 8.5"x11"-sized pages will be used.</p>""")) self.form.tooltips.append((self.a4RadioButton, """\ <p><b>Paper Size, A4</b></p> <p>If checked, when outputting a PDF of the index, European A4-sized pages will be used.</p>""")) def layoutWidgets(self): hbox = QHBoxLayout() hbox.addWidget(self.indentLabel) hbox.addWidget(self.indentComboBox) hbox.addStretch() self.txtGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.rtfIndentLabel) hbox.addWidget(self.rtfIndentComboBox) hbox.addStretch() self.rtfGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.paperSizeLabel) hbox.addWidget(self.letterRadioButton) hbox.addWidget(self.a4RadioButton) hbox.addStretch() self.pdfGroupBox.setLayout(hbox) vbox = QVBoxLayout() vbox.addWidget(self.rtfGroupBox) vbox.addWidget(self.txtGroupBox) vbox.addWidget(self.pdfGroupBox) vbox.addStretch() self.setLayout(vbox) def createConnections(self): self.indentComboBox.currentIndexChanged.connect(self.setIndent) self.rtfIndentComboBox.currentIndexChanged.connect( self.setIndentRTF) def setIndent(self, index): index = self.indentComboBox.currentIndex() indent = int(self.indentComboBox.itemData(index)) if bool(self.state.model): self.state.model.setConfig(Gconf.Key.Indent, indent) def setIndentRTF(self, index): index = self.rtfIndentComboBox.currentIndex() indent = int(self.rtfIndentComboBox.itemData(index)) settings = QSettings() settings.setValue(Gopt.Key.IndentRTF, indent)
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_SelectionGrow.txt" sgCmds.makeFile( self.infoPath ) validator = QIntValidator() layout = QHBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox() layout.addWidget( groupBox ) hLayout = QHBoxLayout() labelTitle = QLabel( "Grow Selection : " ) buttonGrow = QPushButton( "Grow" ); buttonGrow.setFixedWidth( 50 ) buttonShrink = QPushButton( "Shrink" ); buttonShrink.setFixedWidth( 50 ) lineEdit = QLineEdit(); lineEdit.setValidator( validator );lineEdit.setText( '0' ) hLayout.addWidget( labelTitle ) hLayout.addWidget( buttonGrow ) hLayout.addWidget( buttonShrink ) hLayout.addWidget( lineEdit ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( buttonGrow, QtCore.SIGNAL("clicked()"), self.growNum ) QtCore.QObject.connect( buttonShrink, QtCore.SIGNAL("clicked()"), self.shrinkNum ) self.vtxLineEditList = [] self.loadInfo()