def _initialize(self): ## self.paramTPerm = self.field("paramTPerm") self.tabs.clear() self.total_answers = 0 self.radioGroups = {} filas = int(self.paramNPerm.toString()) for x in range(filas): mygroupbox = QScrollArea() mygroupbox.setWidget(QWidget()) mygroupbox.setWidgetResizable(True) myform = QHBoxLayout(mygroupbox.widget()) cols = self.paramNCols.toString().split(',') ansID = 0 radioGroupList = {} for col in cols: mygroupboxCol = QGroupBox() myformCol = QFormLayout() mygroupboxCol.setLayout(myformCol) for y in range(int(col)): ansID += 1 radioGroupList[ansID] = QButtonGroup() layoutRow = QHBoxLayout() for j in range(int(self.paramNAlts.toString())): myradio = QRadioButton(chr(97+j).upper()) layoutRow.addWidget(myradio) radioGroupList[ansID].addButton(myradio) self.total_answers += 1 myformCol.addRow(str(ansID), layoutRow) myform.addWidget(mygroupboxCol) self.radioGroups[chr(97+x).upper()] = radioGroupList self.tabs.addTab(mygroupbox, _('Model ') + chr(97+x).upper())
def __init__(self, *args, **kwargs): # Initialize the base class... super( DvidDataSelectionBrowser, self ).__init__(*args, **kwargs) self._subvol_widget = SubregionRoiWidget( parent=self ) subvol_layout = QVBoxLayout() subvol_layout.addWidget( self._subvol_widget ) group_title = "Restrict to subvolume (Right-click a volume name above to auto-initialize these subvolume parameters.)" subvol_groupbox = QGroupBox(group_title, parent=self) subvol_groupbox.setCheckable(True) subvol_groupbox.setChecked(False) subvol_groupbox.setEnabled(False) subvol_groupbox.toggled.connect( self._update_status ) subvol_groupbox.setLayout( subvol_layout ) subvol_groupbox.setFixedHeight( 200 ) subvol_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Minimum ) self._subvol_groupbox = subvol_groupbox # Add to the layout layout = self.layout() layout.insertWidget( 3, subvol_groupbox ) # Special right-click behavior. self._repo_treewidget.viewport().installEventFilter(self)
def _init_gui_tab_and_groupbox_widgets(self): #top area for main stuff group_box_main_config = QGroupBox("Configuration") main_config_layout = QFormLayout() widget_delimiter = self._init_gui_delimiter_entries() tab_widget = QTabWidget() tab_widget.addTab(widget_delimiter, "delimiter") tab_widget.addTab(self.color_choosing_widget, "colors") #widget for bottom = save button save_widget = QWidget() layout_save_widget = QFormLayout() save_button = QPushButton("save", self) QObject.connect(save_button, SIGNAL('clicked()'), self._save_config) layout_save_widget.addWidget(save_button) save_widget.setLayout(layout_save_widget) main_config_layout.addRow(self.checkbox_start_with_last_opened_file) group_box_main_config.setLayout(main_config_layout) tab_widget_layout = QVBoxLayout() tab_widget_layout.addWidget(group_box_main_config) tab_widget_layout.addWidget(tab_widget) tab_widget_layout.addWidget(save_widget) return tab_widget_layout
def initAppletDrawerUi(self): training_controls = EdgeTrainingGui.createDrawerControls(self) training_controls.layout().setContentsMargins(5,0,5,0) training_layout = QVBoxLayout() training_layout.addWidget( training_controls ) training_layout.setContentsMargins(0,15,0,0) training_box = QGroupBox( "Training", parent=self ) training_box.setLayout(training_layout) training_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) multicut_controls = MulticutGuiMixin.createDrawerControls(self) multicut_controls.layout().setContentsMargins(5,0,5,0) multicut_layout = QVBoxLayout() multicut_layout.addWidget( multicut_controls ) multicut_layout.setContentsMargins(0,15,0,0) multicut_box = QGroupBox( "Multicut", parent=self ) multicut_box.setLayout(multicut_layout) multicut_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) drawer_layout = QVBoxLayout() drawer_layout.addWidget(training_box) drawer_layout.addWidget(multicut_box) drawer_layout.setSpacing(2) drawer_layout.setContentsMargins(5,5,5,5) drawer_layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) ) self._drawer = QWidget(parent=self) self._drawer.setLayout(drawer_layout)
def _create(self, base_frame): self.sliders = [] self.spinboxes = [] for i in range(len(self.dim_labels)): self.sliders.append(QSlider(QtCore.Qt.Horizontal)) self.sliders[i].setRange(0, self.n_slider_steps[i]) self.sliders[i].valueChanged.connect( partial(self._on_slide, i)) spinbox = QDoubleSpinBox() spinbox.setRange(*self.limits[i]) spinbox.setDecimals(3) spinbox.setSingleStep(0.001) self.spinboxes.append(spinbox) self.spinboxes[i].valueChanged.connect( partial(self._on_pos_edited, i)) slider_group = QGridLayout() slider_group.addWidget(QLabel("Position"), 0, 0, 1, 3, QtCore.Qt.AlignCenter) slider_group.addWidget(QLabel("Orientation (Euler angles)"), 0, 3, 1, 3, QtCore.Qt.AlignCenter) for i, slider in enumerate(self.sliders): slider_group.addWidget(QLabel(self.dim_labels[i]), 1, i) slider_group.addWidget(slider, 2, i) slider_group.addWidget(self.spinboxes[i], 3, i) slider_groupbox = QGroupBox("Transformation in frame '%s'" % base_frame) slider_groupbox.setLayout(slider_group) layout = QHBoxLayout() layout.addWidget(slider_groupbox) layout.addStretch(1) return layout
def setup_page(self): settings_group = QGroupBox(_("Settings")) hist_spin = self.create_spinbox( _("History depth: "), _(" entries"), 'max_entries', min_=10, max_=10000, step=10, tip=_("Set maximum line count")) sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') go_to_eof_box = self.create_checkbox( _("Scroll automatically to last entry"), 'go_to_eof') font_group = self.create_fontgroup(option=None, text=_("Font style"), fontfilters=QFontComboBox.MonospacedFonts) names = CONF.get('color_schemes', 'names') choices = zip(names, names) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') settings_layout = QVBoxLayout() settings_layout.addWidget(hist_spin) settings_group.setLayout(settings_layout) sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(go_to_eof_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(font_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def update(self): for i in range(self.layout().count()): self.layout().itemAt(0).widget().close() self.layout().takeAt(0) qsa = QScrollArea() scroll_area_widget = QWidget() layout = QVBoxLayout() scroll_area_widget.setLayout(layout) model = self.result.model cycles_per_ms = model.cycles_per_ms for proc in model.processors: proc_r = self.result.processors[proc] gb = QGroupBox(proc.name) gb_layout = QVBoxLayout() gb.setLayout(gb_layout) gb_layout.addWidget( QLabel("Cxt Save count: {}".format(proc_r.context_save_count))) gb_layout.addWidget( QLabel("Cxt Load count: {}".format(proc_r.context_load_count))) gb_layout.addWidget( QLabel("Cxt Save overhead: {0:.4f}ms ({1:.0f} cycles)".format( float(proc_r.context_save_overhead) / cycles_per_ms, proc_r.context_save_overhead))) gb_layout.addWidget( QLabel("Cxt Load overhead: {0:.4f}ms ({1:.0f} cycles)".format( float(proc_r.context_load_overhead) / cycles_per_ms, proc_r.context_load_overhead))) layout.addWidget(gb) qsa.setWidget(scroll_area_widget) self.layout().addWidget(qsa)
def setup_page(self): simulation_group = QGroupBox("Simulation") sim_dateedit = self.create_dateedit("Date de la simulation", 'datesim', min_date=QDate(2002, 01, 01), max_date=QDate(2010, 12, 31)) nmen_spinbox = self.create_spinbox(u'Nombre de ménages', '', 'nmen', min_=1, max_=10001, step=100) xaxis_choices = [(u'Salaires', 'sal'), (u'Chômage', 'cho'), (u'Retraites', 'rst')] xaxis_combo = self.create_combobox('Axe des abscisses', xaxis_choices, 'xaxis') maxrev_spinbox = self.create_spinbox("Revenu maximum", 'euros', 'maxrev', min_=0, max_=10000000, step=1000) simulation_layout = QVBoxLayout() simulation_layout.addWidget(sim_dateedit) simulation_layout.addWidget(nmen_spinbox) simulation_layout.addWidget(xaxis_combo) simulation_layout.addWidget(maxrev_spinbox) simulation_group.setLayout(simulation_layout) vlayout = QVBoxLayout() vlayout.addWidget(simulation_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent self.objets = parent.objets self.sizer = QVBoxLayout() self.infos = infos = QVBoxLayout() if len(self.objets) == 1: self.objet = self.objets[0] else: self.objet = None # cela n'a pas vraiment de sens d'afficher une longueur pour 3 segments differents par exemple... self.textes = [] proprietes = ("aire", "centre", "coordonnees", "rayon", "longueur", "perimetre", "norme", "sens") for propriete in proprietes: try: self.ajouter(infos, propriete) except: debug(u"Erreur lors de la lecture de la propriété '%s' de l'objet %s." %(propriete, self.objet.nom)) print_error() self.ajouter(infos, "equation_formatee", u"Equation cartésienne") if self.textes: infos_box = QGroupBox(u"Informations") infos_box.setLayout(infos) self.sizer.addWidget(infos_box) actualiser = QPushButton(u"Actualiser") actualiser.clicked.connect(self.EvtActualiser) self.sizer.addWidget(actualiser) else: self.sizer.addWidget(QLabel(str(len(self.objets)) + u" objets sélectionnés.")) self.setLayout(self.sizer)
def initAppletDrawerUi(self): training_controls = EdgeTrainingGui.createDrawerControls(self) training_controls.layout().setContentsMargins(5,0,5,0) training_layout = QVBoxLayout() training_layout.addWidget( training_controls ) training_layout.setContentsMargins(0,0,0,0) training_box = QGroupBox( "Training", parent=self ) training_box.setLayout(training_layout) training_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) multicut_controls = MulticutGuiMixin.createDrawerControls(self) multicut_controls.layout().setContentsMargins(5,0,5,0) multicut_layout = QVBoxLayout() multicut_layout.addWidget( multicut_controls ) multicut_layout.setContentsMargins(0,0,0,0) multicut_box = QGroupBox( "Multicut", parent=self ) multicut_box.setLayout(multicut_layout) multicut_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) drawer_layout = QVBoxLayout() drawer_layout.addWidget(training_box) drawer_layout.addWidget(multicut_box) drawer_layout.setSpacing(2) drawer_layout.setContentsMargins(5,5,5,5) drawer_layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) ) self._drawer = QWidget(parent=self) self._drawer.setLayout(drawer_layout)
def choice(self, title, msg, choices): vbox = QVBoxLayout() self.set_layout(vbox) vbox.addWidget(QLabel(title)) gb2 = QGroupBox(msg) vbox.addWidget(gb2) vbox2 = QVBoxLayout() gb2.setLayout(vbox2) group2 = QButtonGroup() for i, c in enumerate(choices): button = QRadioButton(gb2) button.setText(c[1]) vbox2.addWidget(button) group2.addButton(button) group2.setId(button, i) if i == 0: button.setChecked(True) vbox.addStretch(1) vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _('Next')))) if not self.exec_(): return wallet_type = choices[group2.checkedId()][0] return wallet_type
def __init__(self, parent): CstmPanel.__init__(self, parent) # Légendes box = QGroupBox(u"Légende des axes") sizer = QHBoxLayout() box.setLayout(sizer) self.sx = QLabel(u"Abscisses:") sizer.addWidget(self.sx) self.x = QLineEdit() self.x.setText(self.main.legende_x) self.x.setMinimumWidth(200) self.x.returnPressed.connect(self.main.actualiser) sizer.addWidget(self.x) self.sy = QLabel(u"Ordonnées:") sizer.addWidget(self.sy) self.y = QLineEdit() self.y.setText(self.main.legende_y) self.y.setMinimumWidth(200) self.y.returnPressed.connect(self.main.actualiser) sizer.addWidget(self.y) self.sa = QLabel(u"Aire:") sizer.addWidget(self.sa) self.a = QLineEdit() self.a.setText(self.main.legende_a) self.a.setMinimumWidth(100) self.a.setToolTip(u"Pour les histogrammes.\nIndique en quelle unité s'exprime la quantité.\nExemples:\npersonnes, ampoules, %, $, ...") self.a.returnPressed.connect(self.main.actualiser) sizer.addWidget(self.a) self.add(box) self.finaliser()
def __init__(self, buttonText, imagePath, buttonCallback, imageSize, parent=None): QWidget.__init__(self, parent) icon = QLabel(self) icon.setPixmap(QPixmap(imagePath).scaled(imageSize, imageSize)) button = QPushButton(buttonText) button.clicked.connect(buttonCallback) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addWidget(icon, alignment=Qt.AlignHCenter) vbox.addSpacing(20) vbox.addWidget(button) vbox.addStretch(1) # Add some horizontal padding hbox = QHBoxLayout() hbox.addSpacing(10) hbox.addLayout(vbox) hbox.addSpacing(10) groupBox = QGroupBox() groupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(groupBox) hbox.addStretch(1) self.setLayout(hbox)
def _initialize(self): ## self.paramTPerm = self.field("paramTPerm") self.tabs.clear() self.total_answers = 0 self.radioGroups = {} filas = int(self.paramNPerm.toString()) for x in range(filas): mygroupbox = QScrollArea() mygroupbox.setWidget(QWidget()) mygroupbox.setWidgetResizable(True) myform = QHBoxLayout(mygroupbox.widget()) cols = self.paramNCols.toString().split(',') ansID = 0 radioGroupList = {} for col in cols: mygroupboxCol = QGroupBox() myformCol = QFormLayout() mygroupboxCol.setLayout(myformCol) for y in range(int(col)): ansID += 1 radioGroupList[ansID] = QButtonGroup() layoutRow = QHBoxLayout() for j in range(int(self.paramNAlts.toString())): myradio = QRadioButton(chr(97 + j).upper()) layoutRow.addWidget(myradio) radioGroupList[ansID].addButton(myradio) self.total_answers += 1 myformCol.addRow(str(ansID), layoutRow) myform.addWidget(mygroupboxCol) self.radioGroups[chr(97 + x).upper()] = radioGroupList self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
def __init__(self, parent): CstmPanel.__init__(self, parent) box = QGroupBox(u"Construction de quantiles") sizer = QHBoxLayout() box.setLayout(sizer) self.mediane = QCheckBox(u'Construire la médiane') self.mediane.setChecked(self.main.param("quantiles")["mediane"][0]) self.mediane.stateChanged.connect(self.main.EvtCheck) sizer.addWidget(self.mediane) sizer.addSpacing(10) # valeur à ajuster self.quartiles = QCheckBox(u'Construire les quartiles') self.quartiles.setChecked(self.main.param("quantiles")["quartiles"][0]) self.quartiles.stateChanged.connect(self.main.EvtCheck) sizer.addWidget(self.quartiles) sizer.addSpacing(10) # valeur à ajuster self.deciles = QCheckBox(u'Construire les déciles') self.deciles.setChecked(self.main.param("quantiles")["deciles"][0]) self.deciles.stateChanged.connect(self.main.EvtCheck) sizer.addWidget(self.deciles) sizer.addSpacing(10) # valeur à ajuster self.add(box) self.finaliser()
def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent self.objets = parent.objets self.panel = self.parent.parent.panel self.canvas = self.parent.parent.canvas self.islabel = self.parent.parent.islabel self.sizer = QVBoxLayout() if len(self.objets) is 1: self.objet = self.objets[0] style = QVBoxLayout() style_box = QGroupBox(u"Style de l'objet") style_box.setLayout(style) style.addWidget(QLabel(u"Attention, ne modifiez ce contenu que si vous savez ce que vous faites.")) self.avance = QTextEdit() self.avance.setMinimumSize(350, 200) self.actualiser() style.addWidget(self.avance) self.sizer.addWidget(style_box) ok = QPushButton('OK') appliquer = QPushButton(u"Appliquer") actualiser = QPushButton(u"Actualiser") ok.clicked.connect(self.EvtOk) appliquer.clicked.connect(self.EvtAppliquer) actualiser.clicked.connect(self.actualiser) boutons = QHBoxLayout() boutons.addWidget(ok) boutons.addWidget(appliquer) boutons.addWidget(actualiser) self.sizer.addLayout(boutons) self.setLayout(self.sizer)
def init_view(self): field_group = QGroupBox('Field') field_layout = QVBoxLayout() field_layout.addWidget(self) field_layout.addStretch(1) field_group.setLayout(field_layout) return field_group
def initUI(self): # title title = QLabel(self) title.setText("User Instruction") title.setAlignment(Qt.AlignCenter) # user instruction groupBox = QGroupBox() text = QLabel(self) text.setText("Create image montages and histograms from the interface:\nChoose option No. 1 to 5 on main interface.\nClick Enter to select the paths for input and output locations.\nEnjoy using the interface!") self.setStyleSheet("QLabel { color: #8B4513; font-size: 16px;font-family: cursive, sans-serif;}") title.setStyleSheet("QLabel { color: #8B4513; font-weight: 600;}") # set layout sbox = QVBoxLayout(self) sbox.addWidget(text) groupBox.setLayout(sbox) vBoxLayout = QVBoxLayout() vBoxLayout.addSpacing(15) vBoxLayout.addWidget(title) vBoxLayout.addWidget(groupBox) vBoxLayout.addSpacing(15) self.setLayout(vBoxLayout) # set background as transparent palette = QPalette() palette.setBrush(QPalette.Background,QBrush(QPixmap())) self.setPalette(palette)
def _drawButtons(self, logoFnam): gbox = QGroupBox() spol = QSizePolicy() spol.horizontalPolicy = QSizePolicy.Maximum gbox.setSizePolicy(spol) vbox = QVBoxLayout() if os.path.isfile(logoFnam): img = QPixmap(logoFnam) #.scaled(64, 64) lblLogo = QLabel() lblLogo.setPixmap(img) lblLogo.setAlignment(Qt.AlignTop | Qt.AlignRight) vbox.addWidget(lblLogo) #vbox.addSpacing(3) self.butSave = self._drawButton(vbox, "M&odify", 'closeSave') font = QFont() font.setBold(True) self.butSave.setFont(font) self.butCancel = self._drawButton(vbox, "Cancel", 'closeCancel', True) vbox.addSpacing(36) self.butAddRule = self._drawButton(vbox, "Add Rule", 'addRule', True) self.butCopyRule = self._drawButton(vbox, "Copy Rule", 'copyRule') self.butDelRule = self._drawButton(vbox, "Delete Rule", 'delRule') self.butMoveRuleUp = self._drawButton(vbox, "Move Rule Up", 'moveRuleUp') self.butMoveRuleDn = self._drawButton(vbox, "Move Rule Down", 'moveRuleDown') vbox.addSpacing(24) self.butAddCond = self._drawButton(vbox, "Add Condition", 'addCond') self.butDelCond = self._drawButton(vbox, "Delete Condition", 'delCond') vbox.addSpacing(15) self.butAddAction = self._drawButton(vbox, "Add Action", 'addAction') self.butDelAction = self._drawButton(vbox, "Delete Action", 'delAction') gbox.setLayout(vbox) self.mainHSplit.addWidget(gbox)
def __init__(self, toolbox): super(Articulations, self).__init__(toolbox, 'articulation', i18n("Articulations"), symbol='articulation_prall', tooltip=i18n("Different kinds of articulations and other signs.")) layout = QVBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) # help text self.setWhatsThis("<p>{0}</p><p>{1}</p>".format( i18n("Click an articulation sign to add it to your document."), i18n("If you select some music first, the articulation will " "be added to all notes in the selection."))) self.shorthands = QCheckBox(i18n("Allow shorthands")) self.shorthands.setChecked(True) self.shorthands.setToolTip(i18n( "Use short notation for some articulations like staccato.")) layout.addWidget(self.shorthands) self.titles = dict(ly.articulation.articulations(i18n)) for title, group in ly.articulation.groups(i18n): box = QGroupBox(title) layout.addWidget(box) grid = QGridLayout() grid.setSpacing(0) box.setLayout(grid) for num, (sign, title) in enumerate(group): row, col = divmod(num, COLUMNS) b = ActionButton(self, sign, title, 'articulation_' + sign, tooltip='<b>{0}</b> (\\{1})'.format(title, sign)) grid.addWidget(b, row, col) layout.addStretch()
def __init__(self, *args, **kwargs): # Initialize the base class... super(DvidDataSelectionBrowser, self).__init__(*args, **kwargs) self._subvol_widget = SubregionRoiWidget(parent=self) subvol_layout = QVBoxLayout() subvol_layout.addWidget(self._subvol_widget) group_title = ( "Restrict to subvolume (Right-click a volume name above to auto-initialize these subvolume parameters.)" ) subvol_groupbox = QGroupBox(group_title, parent=self) subvol_groupbox.setCheckable(True) subvol_groupbox.setChecked(False) subvol_groupbox.setEnabled(False) subvol_groupbox.toggled.connect(self._update_status) subvol_groupbox.setLayout(subvol_layout) subvol_groupbox.setFixedHeight(200) subvol_groupbox.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum) self._subvol_groupbox = subvol_groupbox # Add to the layout layout = self.layout() layout.insertWidget(3, subvol_groupbox) # Special right-click behavior. self._repo_treewidget.viewport().installEventFilter(self)
def __init__(self, parent=None): QWizardPage.__init__(self, parent) self.parent = parent self.setTitle(self.tr("Add dumps")) label = QLabel( self. tr("What do you want to analyse? " "The first step is to choose some dumps for analysis. " "You could load a local file, a dump or choose to mount connected devices" )) label.setWordWrap(True) layout = QGridLayout() layout.addWidget(label, 0, 0) groupBox = QGroupBox(self.tr("Dumps")) self.localFilesRadioButton = QRadioButton(self.tr("Add a local file")) self.deviceRadioButton = QRadioButton(self.tr("Add a device")) self.localFilesRadioButton.setChecked(True) groupBoxLayout = QVBoxLayout() groupBoxLayout.addWidget(self.localFilesRadioButton) groupBoxLayout.addWidget(self.deviceRadioButton) groupBox.setLayout(groupBoxLayout) layout.addWidget(groupBox, 1, 0) self.setLayout(layout)
def descriptionBox(self): groupBox = QGroupBox(self.tr("Description")) label = QLabel(QString(self.module.conf.description)) label.setWordWrap(True) groupBoxLayout = QVBoxLayout() groupBoxLayout.addWidget(label) groupBox.setLayout(groupBoxLayout) return groupBox
def assemble(self): grp_box = QGroupBox(self._name) vbox = QVBoxLayout() for control in self._controls: vbox.addWidget(control) grp_box.setLayout(vbox) return grp_box
def setup_page(self): tabs = QTabWidget() names = self.get_option("names") names.pop(names.index(CUSTOM_COLOR_SCHEME_NAME)) names.insert(0, CUSTOM_COLOR_SCHEME_NAME) fieldnames = { "background": _("Background:"), "currentline": _("Current line:"), "occurence": _("Occurence:"), "ctrlclick": _("Link:"), "sideareas": _("Side areas:"), "matched_p": _("Matched parentheses:"), "unmatched_p": _("Unmatched parentheses:"), "normal": _("Normal text:"), "keyword": _("Keyword:"), "builtin": _("Builtin:"), "definition": _("Definition:"), "comment": _("Comment:"), "string": _("String:"), "number": _("Number:"), "instance": _("Instance:"), } from SMlib.widgets.sourcecode import syntaxhighlighters assert all([key in fieldnames for key in syntaxhighlighters.COLOR_SCHEME_KEYS]) for tabname in names: cs_group = QGroupBox(_("Color scheme")) cs_layout = QGridLayout() for row, key in enumerate(syntaxhighlighters.COLOR_SCHEME_KEYS): option = "%s/%s" % (tabname, key) value = self.get_option(option) name = fieldnames[key] if isinstance(value, basestring): label, clayout = self.create_coloredit(name, option, without_layout=True) label.setAlignment(Qt.AlignRight|Qt.AlignVCenter) cs_layout.addWidget(label, row+1, 0) cs_layout.addLayout(clayout, row+1, 1) else: label, clayout, cb_bold, cb_italic = self.create_scedit( name, option, without_layout=True) label.setAlignment(Qt.AlignRight|Qt.AlignVCenter) cs_layout.addWidget(label, row+1, 0) cs_layout.addLayout(clayout, row+1, 1) cs_layout.addWidget(cb_bold, row+1, 2) cs_layout.addWidget(cb_italic, row+1, 3) cs_group.setLayout(cs_layout) if tabname in sh.COLOR_SCHEME_NAMES: def_btn = self.create_button(_("Reset to default values"), lambda: self.reset_to_default(tabname)) tabs.addTab(self.create_tab(cs_group, def_btn), tabname) else: tabs.addTab(self.create_tab(cs_group), tabname) vlayout = QVBoxLayout() vlayout.addWidget(tabs) self.setLayout(vlayout)
def _add_log_box(self): box = QGroupBox("Application log") box.setLayout(QHBoxLayout(box)) self.log_area = QTextBrowser(box) self.log_area.setLineWrapMode(QTextEdit.NoWrap) box.layout().addWidget(self.log_area) self.layout().addWidget(box)
def __init__(self, toolbox): super(BarLines, self).__init__(toolbox, 'bar', i18n("Bar Lines"), symbol='bar_single', tooltip=i18n("Bar lines, breathing signs, etcetera.")) layout = QVBoxLayout(self) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) bars = QGroupBox(i18n("Bar Lines")) grid = QGridLayout() grid.setSpacing(0) bars.setLayout(grid) self.bars = {} for num, (name, bar, title) in enumerate(( ("double", "||", i18n("Double bar line")), ("end", "|.", i18n("Ending bar line")), ("dotted", ":", i18n("Dotted bar line")), ("dashed", "dashed", i18n("Dashed bar line")), ("invisible", "", i18n("Invisible bar line")), ("repeat_start", "|:", i18n("Repeat start")), ("repeat_double", ":|:", i18n("Repeat both")), ("repeat_end", ":|", i18n("Repeat end")), ("cswc", ":|.:", i18n("Repeat both (old)")), ("cswsc", ":|.|:", i18n("Repeat both (classic)")), ("tick", "'", i18n("Tick bar line")), ("single", "|", i18n("Single bar line")), ("sws", "|.|", i18n("Small-Wide-Small bar line")), ("ws", ".|", i18n("Wide-Small bar line")), ("ww", ".|.", i18n("Double wide bar line")), ("segno", "S", i18n("Segno bar line")), )): self.bars[name] = (bar, title) b = ActionButton(self, name, title, 'bar_' + name) row, col = divmod(num, COLUMNS) grid.addWidget(b, row, col) layout.addWidget(bars) breathes = QGroupBox(i18n("Breathing Signs")) grid = QGridLayout() grid.setSpacing(0) breathes.setLayout(grid) self.breathes = {} for num, (name, title) in enumerate(( ('rcomma', i18n("Default Breathing Sign")), ('rvarcomma', i18n("Straight Breathing Sign")), ('caesura_curved', i18n("Curved Caesura")), ('caesura_straight', i18n("Straight Caesura")), )): self.breathes[name] = title b = ActionButton(self, name, title, 'breathe_' + name) row, col = divmod(num, COLUMNS) grid.addWidget(b, row, col) layout.addWidget(breathes) layout.addStretch()
def __init__(self, parent=None, paths=None): QDialog.__init__(self, parent) QShortcut(QKeySequence("Escape"), self, self.reject) self.setWindowTitle("manageR - Help Browser") self.resize(500, 500) port = robjects.r('tools:::httpdPort')[0] if not port > 0: robjects.r('tools::startDynamicHelp()') port = robjects.r('tools:::httpdPort')[0] host = "localhost" home = "/doc/html/Search.html" self.htmlBrowser = HtmlBrowser(self, host, port, home, paths) self.checkboxes = [] self.titleCheckbox = QCheckBox("Help page titles", self) self.titleCheckbox.setChecked(True) self.checkboxes.append(self.titleCheckbox) self.keywordsCheckbox = QCheckBox("Keywords", self) self.keywordsCheckbox.setChecked(True) self.checkboxes.append(self.keywordsCheckbox) self.aliasCheckbox = QCheckBox("Object names", self) self.aliasCheckbox.setChecked(True) self.checkboxes.append(self.aliasCheckbox) self.conceptCheckbox = QCheckBox("Concepts", self) self.conceptCheckbox.setChecked(False) self.checkboxes.append(self.conceptCheckbox) self.exactCheckbox = QCheckBox("Exact match", self) self.exactCheckbox.setChecked(False) self.checkboxes.append(self.exactCheckbox) self.searchButton = QPushButton("Search", self) self.searchEdit = QLineEdit(self) self.htmlBrowser.setSource(QUrl(home)) bbox = QVBoxLayout(self) hbox = QHBoxLayout() hbox.addWidget(self.searchEdit) hbox.addWidget(self.searchButton) bbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addStretch() for checkbox in self.checkboxes[0:3]: hbox.addWidget(checkbox) hbox.addStretch() vbox = QVBoxLayout() vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addStretch() for checkbox in self.checkboxes[3:]: hbox.addWidget(checkbox) hbox.addStretch() vbox.addLayout(hbox) parameters = QGroupBox("Search Parameters") parameters.setLayout(vbox) bbox.addWidget(parameters) bbox.addWidget(self.htmlBrowser) self.connect(self.searchButton, SIGNAL("clicked()"), self.search) self.connect(self.searchEdit, SIGNAL("returnPressed()"), self.search)
def buildPostProcessorForm(self, theParams): """Build Post Processor Tab Args: * theParams - dictionary containing element of form Returns: not applicable """ # create postprocessors tab myTab = QWidget() myFormLayout = QFormLayout(myTab) myFormLayout.setLabelAlignment(Qt.AlignLeft) self.tabWidget.addTab(myTab, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create element for the tab myValues = {} for myLabel, myOptions in theParams.items(): myInputValues = {} # NOTE (gigih) : 'params' is assumed as dictionary if 'params' in myOptions: myGroupBox = QGroupBox() myGroupBox.setCheckable(True) myGroupBox.setTitle(get_postprocessor_human_name(myLabel)) # NOTE (gigih): is 'on' always exist?? myGroupBox.setChecked(myOptions.get('on')) myInputValues['on'] = self.bind(myGroupBox, 'checked', bool) myLayout = QFormLayout(myGroupBox) myGroupBox.setLayout(myLayout) # create widget element from 'params' myInputValues['params'] = {} for myKey, myValue in myOptions['params'].items(): myHumanName = get_postprocessor_human_name(myKey) myInputValues['params'][myKey] = self.buildWidget( myLayout, myHumanName, myValue) myFormLayout.addRow(myGroupBox, None) elif 'on' in myOptions: myCheckBox = QCheckBox() myCheckBox.setText(get_postprocessor_human_name(myLabel)) myCheckBox.setChecked(myOptions['on']) myInputValues['on'] = self.bind(myCheckBox, 'checked', bool) myFormLayout.addRow(myCheckBox, None) else: raise NotImplementedError('This case is not handled for now') myValues[myLabel] = myInputValues self.values['postprocessors'] = myValues
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 )
def createColorPreviewGroupBox(self): self.colorPreviewLabel = QLabel('Example Text') self.updateColorPreview() colorPreviewLayout = QVBoxLayout() colorPreviewLayout.addWidget(self.colorPreviewLabel) groupBox = QGroupBox('Preview') groupBox.setLayout(colorPreviewLayout) return groupBox
def _build_group_gui(self, group): grp_box = QGroupBox(group.desc, self.configFormWidget) grp_box.setLayout(QGridLayout()) for opt in group.options: if opt.name in self._skip_options: continue self._fields[opt.name] = Field(opt, grp_box) self.configForm.addWidget(grp_box) #customization if group.name == 'iPCR': self._setup_seq_db_view(grp_box)
def group_box( title=None, layout=None, margin=None, flat=False, ): gb = QGroupBox(title=title, flat=flat) if layout is not None: gb.setLayout(layout) return gb
def __init__(self, *args, **kwargs): super(ShortcutManagerDlg, self).__init__(*args, **kwargs) self.setWindowTitle("Shortcut Preferences") self.setMinimumWidth(500) mgr = ShortcutManager() # Singleton tempLayout = QVBoxLayout() # Create a LineEdit for each shortcut, # and keep track of them in a dict shortcutEdits = dict() for group, shortcutDict in mgr.shortcuts.items(): grpBox = QGroupBox(group) l = QGridLayout(self) for i, (shortcut, (desc, obj)) in enumerate(shortcutDict.items()): l.addWidget(QLabel(desc), i, 0) edit = QLineEdit(str(shortcut.key().toString())) l.addWidget(edit, i, 1) shortcutEdits[shortcut] = edit grpBox.setLayout(l) tempLayout.addWidget(grpBox) # Add ok and cancel buttons buttonLayout = QHBoxLayout() cancelButton = QPushButton("Cancel") cancelButton.clicked.connect(self.reject) okButton = QPushButton("OK") okButton.clicked.connect(self.accept) okButton.setDefault(True) buttonLayout.addSpacerItem(QSpacerItem(10, 0)) buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) tempLayout.addLayout(buttonLayout) self.setLayout(tempLayout) # Show the window result = self.exec_() # If the user didn't hit "cancel", apply his changes to the manager's shortcuts if result == QDialog.Accepted: for shortcut, edit in shortcutEdits.items(): oldKey = shortcut.key() newKey = str(edit.text()) shortcut.setKey(QKeySequence(newKey)) # If the user typed an invalid shortcut, then keep the old value if shortcut.key().isEmpty(): shortcut.setKey(oldKey) # Make sure the tooltips get updated. mgr.updateToolTip(shortcut) mgr.storeToPreferences()
class Score(_base.Group, scoreproperties.ScoreProperties): @staticmethod def title(_=_base.translate): return _("Score") def createWidgets(self, layout): self.pieceLabel = QLabel() self.piece = QLineEdit() self.pieceLabel.setBuddy(self.piece) self.opusLabel = QLabel() self.opus = QLineEdit() self.opusLabel.setBuddy(self.opus) self.scoreProps = QGroupBox(checkable=True, checked=False) scoreproperties.ScoreProperties.createWidgets(self) grid = QGridLayout() grid.addWidget(self.pieceLabel, 0, 0) grid.addWidget(self.piece, 0, 1) grid.addWidget(self.opusLabel, 1, 0) grid.addWidget(self.opus, 1, 1) layout.addLayout(grid) layout.addWidget(self.scoreProps) layout = QVBoxLayout() self.scoreProps.setLayout(layout) scoreproperties.ScoreProperties.layoutWidgets(self, layout) scorewiz = self.scoreProps.window() self.setPitchLanguage(scorewiz.pitchLanguage()) scorewiz.pitchLanguageChanged.connect(self.setPitchLanguage) def translateWidgets(self): self.pieceLabel.setText(_("Piece:")) self.opusLabel.setText(_("Opus:")) self.scoreProps.setTitle(_("Properties")) scoreproperties.ScoreProperties.translateWidgets(self) def accepts(self): return (StaffGroup, _base.Part) def makeNode(self, node): score = ly.dom.Score(node) h = ly.dom.Header() piece = self.piece.text().strip() opus = self.opus.text().strip() if piece: h['piece'] = ly.dom.QuotedString(piece) if opus: h['opus'] = ly.dom.QuotedString(opus) if len(h): score.append(h) return score def globalSection(self, builder): if self.scoreProps.isChecked(): return scoreproperties.ScoreProperties.globalSection(self, builder)
def __init__(self, *args, **kwargs): super(ShortcutManagerDlg, self).__init__(*args, **kwargs) self.setWindowTitle("Shortcut Preferences") self.setMinimumWidth(500) mgr = ShortcutManager() # Singleton tempLayout = QVBoxLayout() # Create a LineEdit for each shortcut, # and keep track of them in a dict shortcutEdits = dict() for group, shortcutDict in mgr.shortcuts.items(): grpBox = QGroupBox(group) l = QGridLayout(self) for i, (shortcut, (desc, obj)) in enumerate(shortcutDict.items()): l.addWidget(QLabel(desc), i,0) edit = QLineEdit(str(shortcut.key().toString())) l.addWidget(edit, i,1) shortcutEdits[shortcut] = edit grpBox.setLayout(l) tempLayout.addWidget(grpBox) # Add ok and cancel buttons buttonLayout = QHBoxLayout() cancelButton = QPushButton("Cancel") cancelButton.clicked.connect( self.reject ) okButton = QPushButton("OK") okButton.clicked.connect( self.accept ) okButton.setDefault(True) buttonLayout.addSpacerItem(QSpacerItem(10, 0)) buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) tempLayout.addLayout(buttonLayout) self.setLayout(tempLayout) # Show the window result = self.exec_() # If the user didn't hit "cancel", apply his changes to the manager's shortcuts if result == QDialog.Accepted: for shortcut, edit in shortcutEdits.items(): oldKey = shortcut.key() newKey = str(edit.text()) shortcut.setKey( QKeySequence(newKey) ) # If the user typed an invalid shortcut, then keep the old value if shortcut.key().isEmpty(): shortcut.setKey(oldKey) # Make sure the tooltips get updated. mgr.updateToolTip(shortcut) mgr.storeToPreferences()
class Score(_base.Group, scoreproperties.ScoreProperties): @staticmethod def title(_=_base.translate): return _("Score") def createWidgets(self, layout): self.pieceLabel = QLabel() self.piece = QLineEdit() self.pieceLabel.setBuddy(self.piece) self.opusLabel = QLabel() self.opus = QLineEdit() self.opusLabel.setBuddy(self.opus) self.scoreProps = QGroupBox(checkable=True, checked=False) scoreproperties.ScoreProperties.createWidgets(self) grid = QGridLayout() grid.addWidget(self.pieceLabel, 0 ,0) grid.addWidget(self.piece, 0, 1) grid.addWidget(self.opusLabel, 1, 0) grid.addWidget(self.opus, 1, 1) layout.addLayout(grid) layout.addWidget(self.scoreProps) layout = QVBoxLayout() self.scoreProps.setLayout(layout) scoreproperties.ScoreProperties.layoutWidgets(self, layout) scorewiz = self.scoreProps.window() self.setPitchLanguage(scorewiz.pitchLanguage()) scorewiz.pitchLanguageChanged.connect(self.setPitchLanguage) def translateWidgets(self): self.pieceLabel.setText(_("Piece:")) self.opusLabel.setText(_("Opus:")) self.scoreProps.setTitle(_("Properties")) scoreproperties.ScoreProperties.translateWidgets(self) def accepts(self): return (StaffGroup, _base.Part) def makeNode(self, node): score = ly.dom.Score(node) h = ly.dom.Header() piece = self.piece.text().strip() opus = self.opus.text().strip() if piece: h['piece'] = ly.dom.QuotedString(piece) if opus: h['opus'] = ly.dom.QuotedString(opus) if len(h): score.append(h) return score def globalSection(self, builder): if self.scoreProps.isChecked(): return scoreproperties.ScoreProperties.globalSection(self, builder)
def _initAppletDrawerUic(self): super(ObjectClassificationDataExportGui, self)._initAppletDrawerUic() from PyQt4.QtGui import QGroupBox, QPushButton, QVBoxLayout group = QGroupBox("Export Object Feature Table", self.drawer) group.setLayout(QVBoxLayout()) self.drawer.layout().addWidget(group) btn = QPushButton("Configure and export", group) btn.clicked.connect(self.show_export_dialog) group.layout().addWidget(btn)
def setup_page(self): dirs_group = QGroupBox(u"Répertoires de sauvegarde") cas_type_dir = self.create_browsedir(u'Cas types', 'cas_type_dir') reformes_dir = self.create_browsedir(u'Réformes', 'reformes_dir') calib_dir = self.create_browsedir(u'Calages', 'calib_dir') data_dir = self.create_browsedir(u'Données internes', 'data_dir') survey_group = QGroupBox(u"Données d'enquête") survey_bg = QButtonGroup(self) survey_label = QLabel( u"Emplacement des données d'enquête pour la microsimulation") bareme_only_radio = self.create_radiobutton(u"Mode barème uniquement", 'survey_data/bareme_only', False, u"Mode barème uniquement", button_group=survey_bg) survey_radio = self.create_radiobutton( "le fichier suivant", 'survey_data/survey_enabled', True, "Fichier de données pour la microsimulation", button_group=survey_bg) survey_file = self.create_browsefile("", 'survey_data/file', filters='*.csv') self.connect(bareme_only_radio, SIGNAL("toggled(bool)"), survey_file.setDisabled) self.connect(survey_radio, SIGNAL("toggled(bool)"), survey_file.setEnabled) survey_file_layout = QHBoxLayout() survey_file_layout.addWidget(survey_radio) survey_file_layout.addWidget(survey_file) survey_layout = QVBoxLayout() survey_layout.addWidget(survey_label) survey_layout.addWidget(bareme_only_radio) survey_layout.addLayout(survey_file_layout) survey_group.setLayout(survey_layout) dirs_layout = QVBoxLayout() dirs_layout.addWidget(cas_type_dir) dirs_layout.addWidget(reformes_dir) dirs_layout.addWidget(calib_dir) dirs_group.setLayout(dirs_layout) paths_layout = QVBoxLayout() paths_layout.addWidget(dirs_group) paths_layout.addWidget(survey_group) paths_layout.addWidget(data_dir) paths_layout.addStretch(1) self.setLayout(paths_layout)
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.tableWidget = QTableWidget() self.tableWidget.setColumnCount(3) self.tableWidget.verticalHeader().hide() groupBox1 = QGroupBox('Experiment data') buttonHelp = QPushButton('help') buttonHelp.setEnabled(False) buttonHelp.setToolTip('Enter the input weights into the "w(i)" column and the signal values into the "x(i)"\n' + 'column.\n\n' + 'TIP: To recalculate the result, press Enter. To increment and decrement the value\n' + 'using the arrow keys, press F2 first or click the apropriate table cell with the left\n' + 'mouse button.') hboxLayoutGroupBox1 = QHBoxLayout() hboxLayoutGroupBox1.addWidget(QLabel('Enter the input weights and signal\n' + 'values in the table below')) hboxLayoutGroupBox1.addWidget(buttonHelp) vboxLayoutGroupBox1 = QVBoxLayout() vboxLayoutGroupBox1.addLayout(hboxLayoutGroupBox1) vboxLayoutGroupBox1.addWidget(self.tableWidget) groupBox1.setLayout(vboxLayoutGroupBox1) vboxLayout1 = QVBoxLayout() vboxLayout1.addWidget(QLabel('Perform experiments')) vboxLayout1.addWidget(groupBox1) groupBox2 = QGroupBox('Experiment result') self.memoryEdit = QLineEdit() self.memoryEdit.setReadOnly(True) self.signalEdit = QLineEdit() self.signalEdit.setReadOnly(True) self.outputEdit = QLineEdit() self.outputEdit.setReadOnly(True) self.buttonRecalculate = QPushButton('Recalculate!') gridLayoutGroupBox2 = QGridLayout() gridLayoutGroupBox2.addWidget(QLabel('Memory trace strength'), 0, 0) gridLayoutGroupBox2.addWidget(self.memoryEdit, 0, 1) gridLayoutGroupBox2.addWidget(QLabel('Input signal strength'), 1, 0) gridLayoutGroupBox2.addWidget(self.signalEdit, 1, 1) gridLayoutGroupBox2.addWidget(QLabel('Output'), 2, 0) gridLayoutGroupBox2.addWidget(self.outputEdit, 2, 1) gridLayoutGroupBox2.addWidget(self.buttonRecalculate, 3, 0) groupBox2.setLayout(gridLayoutGroupBox2) hboxLayout = QHBoxLayout() hboxLayout.addLayout(vboxLayout1) hboxLayout.addWidget(groupBox2) self.setLayout(hboxLayout)
def _initAppletDrawerUic(self): super(TrackingBaseDataExportGui, self)._initAppletDrawerUic() from PyQt4.QtGui import QGroupBox, QPushButton, QVBoxLayout group = QGroupBox("Export Object Feature and Tracking Table", self.drawer) group.setLayout(QVBoxLayout()) self.drawer.layout().addWidget(group) btn = QPushButton("Configure and export", group) btn.clicked.connect(self.show_export_dialog) group.layout().addWidget(btn)
def build_post_processor_form(self, parameters): """Build Post Processor Tab. :param parameters: A Dictionary containing element of form :type parameters: dict """ # create postprocessors tab tab = QWidget() form_layout = QFormLayout(tab) form_layout.setLabelAlignment(Qt.AlignLeft) self.tabWidget.addTab(tab, self.tr('Postprocessors')) self.tabWidget.tabBar().setVisible(True) # create element for the tab values = OrderedDict() for label, options in parameters.items(): input_values = OrderedDict() # NOTE (gigih) : 'params' is assumed as dictionary if 'params' in options: group_box = QGroupBox() group_box.setCheckable(True) group_box.setTitle(get_postprocessor_human_name(label)) # NOTE (gigih): is 'on' always exist?? # (MB) should always be there group_box.setChecked(options.get('on')) input_values['on'] = self.bind(group_box, 'checked', bool) layout = QFormLayout(group_box) group_box.setLayout(layout) # create widget element from 'params' input_values['params'] = OrderedDict() for key, value in options['params'].items(): input_values['params'][key] = self.build_widget( layout, key, value) form_layout.addRow(group_box, None) elif 'on' in options: checkbox = QCheckBox() checkbox.setText(get_postprocessor_human_name(label)) checkbox.setChecked(options['on']) input_values['on'] = self.bind(checkbox, 'checked', bool) form_layout.addRow(checkbox, None) else: raise NotImplementedError('This case is not handled for now') values[label] = input_values self.values['postprocessors'] = values
def createGeneralTab(self): extractKeyLabel = QLabel('Extract Key') highlightKeyLabel = QLabel('Highlight Key') removeKeyLabel = QLabel('Remove Key') self.extractKeyComboBox = QComboBox() self.highlightKeyComboBox = QComboBox() self.removeKeyComboBox = QComboBox() keys = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for comboBox in [self.extractKeyComboBox, self.highlightKeyComboBox, self.removeKeyComboBox]: comboBox.addItems(keys) self.setDefaultKeys() extractKeyLayout = QHBoxLayout() extractKeyLayout.addWidget(extractKeyLabel) extractKeyLayout.addWidget(self.extractKeyComboBox) highlightKeyLayout = QHBoxLayout() highlightKeyLayout.addWidget(highlightKeyLabel) highlightKeyLayout.addWidget(self.highlightKeyComboBox) removeKeyLayout = QHBoxLayout() removeKeyLayout.addWidget(removeKeyLabel) removeKeyLayout.addWidget(self.removeKeyComboBox) saveButton = QPushButton('Save') saveButton.clicked.connect(self.saveKeys) buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(saveButton) basicControlsLayout = QVBoxLayout() basicControlsLayout.addLayout(extractKeyLayout) basicControlsLayout.addLayout(highlightKeyLayout) basicControlsLayout.addLayout(removeKeyLayout) basicControlsLayout.addLayout(buttonLayout) basicControlsLayout.addStretch() groupBox = QGroupBox('Basic Controls') groupBox.setLayout(basicControlsLayout) layout = QHBoxLayout() layout.addWidget(groupBox) tab = QWidget() tab.setLayout(layout) return tab
def __init__(self, *args, **kw): Panel_API_graphique.__init__(self, *args, **kw) self.couleurs = u"bgrmkcy" self.nombre_courbes = self._param_.nombre_courbes self.boites = [] self.equations = [] self.intervalles = [] eq_box = QGroupBox(u"Équations") entrees = QVBoxLayout() eq_box.setLayout(entrees) for i in range(self.nombre_courbes): ligne = QHBoxLayout() check = TCheckBox('f%s:'%(i+1)) self.boites.append(check) check.setChecked(True) # Par defaut, les cases sont cochees. check.stateChanged.connect(self.synchronise_et_affiche) check.enter.connect(partial(self.select, i)) check.leave.connect(self.select) ligne.addWidget(check) ligne.addWidget(QLabel("Y =")) eq = TLineEdit() self.equations.append(eq) eq.setMinimumWidth(120) eq.enter.connect(partial(self.select, i)) eq.leave.connect(self.select) eq.returnPressed.connect(partial(self.valider, i)) ligne.addWidget(eq) ligne.addWidget(QLabel("sur")) intervalle = TLineEdit() self.intervalles.append(intervalle) intervalle.setMinimumWidth(100) intervalle.enter.connect(partial(self.select, i)) intervalle.leave.connect(self.select) intervalle.returnPressed.connect(partial(self.valider, i)) ligne.addWidget(intervalle) entrees.addLayout(ligne) entrees.addStretch() self.sizer = QHBoxLayout() self.sizer.addWidget(self.canvas, 1) self.sizer.addWidget(eq_box) self.finaliser(contenu=self.sizer) self._changement_feuille()
def _add_additional_prefs(self): box = QGroupBox("Additional Preferences") box.setLayout(QHBoxLayout(box)) log_btn = QPushButton("View Log", box) log_btn.clicked.connect(self.open_log_file) reset_btn = QPushButton("Reset Settings", box) reset_btn.clicked.connect(Settings().reset) box.layout().addWidget(log_btn) box.layout().addWidget(reset_btn) self.layout().addWidget(box)
def __init__(self, parent, options): QDialog.__init__(self, parent) ##self.setPalette(white_palette) self.setWindowTitle(options.titre) self.parent = parent self.onglets = QTabWidget(self) main_sizer = QVBoxLayout() main_sizer.addWidget(self.onglets) self.setLayout(main_sizer) ##dimensions_onglets = [] self.widgets = {} for theme in options: panel = QWidget(self.onglets) sizer = QVBoxLayout() self.onglets.addTab(panel, theme.titre) for elt in theme: if isinstance(elt, Section): box = QGroupBox(elt.titre, panel) bsizer = QVBoxLayout() box.setLayout(bsizer) bsizer.addSpacing(3) for parametre in elt: if isinstance(parametre, Parametre): psizer = self.ajouter_parametre(parametre, panel, sizer) bsizer.addLayout(psizer) elif isinstance(parametre, basestring): bsizer.addWidget(QLabel(parametre)) else: raise NotImplementedError, repr(type(elt)) bsizer.addSpacing(3) sizer.addWidget(box) elif isinstance(elt, Parametre): psizer = self.ajouter_parametre(elt, panel, sizer) sizer.addLayout(psizer) elif isinstance(elt, basestring): sizer.addWidget(QLabel(elt)) else: raise NotImplementedError, repr(type(elt)) boutons = QHBoxLayout() ok = QPushButton(u'OK', clicked=self.ok) boutons.addWidget(ok) defaut = QPushButton(u"Défaut", clicked=self.defaut) boutons.addWidget(defaut) annuler = QPushButton(u"Annuler", clicked=self.close) boutons.addWidget(annuler) sizer.addStretch() sizer.addLayout(boutons) panel.setLayout(sizer)
def __init__(self, sid, parent=None): super(EditForm, self).__init__(parent) self.sid = sid data = self.callData(self.sid) try: details = self.pullDetails(data[1]) pagetitle = str(details[2]) +' Session' except: details = [] pagetitle = 'None' self.l1 = QLabel("Name") self.le = QLineEdit() self.le.setObjectName("name") self.le.setText(str(data[1])) self.l2 = QLabel("Start Date") self.le2 = QDateEdit() self.le2.setObjectName("startdate") #self.le2.setDate(data[2]) self.l3 = QLabel("End Date") self.le3 = QDateEdit() self.le3.setObjectName("enddate") #self.le3.setDate(data[3]) self.pb = QPushButton() self.pb.setObjectName("Submit") self.pb.setText("Submit") self.pb1 = QPushButton() self.pb1.setObjectName("Cancel") self.pb1.setText("Cancel") layout = QFormLayout() layout.addRow(self.l1, self.le) layout.addRow(self.l2, self.le2) layout.addRow(self.l3, self.le3) layout.addRow(self.pb1, self.pb) groupBox = QGroupBox('Edit Session') groupBox.setLayout(layout) grid = QGridLayout() grid.addWidget(groupBox, 0, 0) self.setLayout(grid) self.connect(self.pb, SIGNAL("clicked()"), lambda: self.button_click(data[0], self)) self.connect(self.pb1, SIGNAL("clicked()"),lambda: self.button_close(self)) self.setWindowTitle(pagetitle)
def setup_help(self): help_QGroupBox = QGroupBox(self.tr("Help")) helpLayout = QVBoxLayout() self.help_pButton = QPushButton("Open help in browser") self.help_pButton.clicked[bool].connect(self.open_html_help) self.help_pButton.setEnabled(True) helpLayout.addWidget(self.help_pButton) help_QGroupBox.setLayout(helpLayout) return help_QGroupBox
def __init__(self, sid, mid, parent=None): super(EditDialog, self).__init__(parent) self.sid = sid self.mid = mid displayInfo = self.pullSubjects() dis = self.pullOne(self.mid) self.l1 = QLabel("Assessment Types") self.le = QComboBox() for dd in displayInfo: self.le.addItem(str(dd['name']).upper(), dd['id']) self.le.setObjectName("name") #self.le.setCurrentIndex(2) self.l2 = QLabel("Max Score") self.le2 = QLineEdit() self.le2.setObjectName("maxscore") if dis: self.le2.setText(dis['abbrv']) else: pass self.pb = QPushButton() self.pb.setObjectName("Submit") self.pb.setText("Submit") self.pb1 = QPushButton() self.pb1.setObjectName("Cancel") self.pb1.setText("Cancel") layout = QFormLayout() layout.addRow(self.l1, self.le) layout.addRow(self.l2, self.le2) layout.addRow(self.pb1, self.pb) groupBox = QGroupBox('Add Assessment') groupBox.setLayout(layout) grid = QGridLayout() grid.addWidget(groupBox, 0, 0) self.setLayout(grid) self.connect(self.pb, SIGNAL("clicked()"), lambda: self.button_click(self)) self.connect(self.pb1, SIGNAL("clicked()"), lambda: self.button_close(self)) self.setWindowTitle(self.pagetitle)
def __init__(self, source_stage_index, num_stages, *args, **kwargs): super(LabelDistributionOptionsDlg, self).__init__(*args, **kwargs) from PyQt4.QtCore import Qt from PyQt4.QtGui import QGroupBox, QCheckBox, QRadioButton, QDialogButtonBox self.setWindowTitle( "Distributing from Stage {}".format(source_stage_index + 1)) self.stage_checkboxes = [] for stage_index in range(1, num_stages + 1): self.stage_checkboxes.append( QCheckBox("Stage {}".format(stage_index))) # By default, send labels back into the current stage, at least. self.stage_checkboxes[source_stage_index].setChecked(True) stage_selection_layout = QVBoxLayout() for checkbox in self.stage_checkboxes: stage_selection_layout.addWidget(checkbox) stage_selection_groupbox = QGroupBox( "Send labels from Stage {} to:".format(source_stage_index + 1), self) stage_selection_groupbox.setLayout(stage_selection_layout) self.copy_button = QRadioButton("Copy", self) self.partition_button = QRadioButton("Partition", self) self.partition_button.setChecked(True) distribution_mode_layout = QVBoxLayout() distribution_mode_layout.addWidget(self.copy_button) distribution_mode_layout.addWidget(self.partition_button) distribution_mode_group = QGroupBox("Distribution Mode", self) distribution_mode_group.setLayout(distribution_mode_layout) buttonbox = QDialogButtonBox(Qt.Horizontal, parent=self) buttonbox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) dlg_layout = QVBoxLayout() dlg_layout.addWidget(stage_selection_groupbox) dlg_layout.addWidget(distribution_mode_group) dlg_layout.addWidget(buttonbox) self.setLayout(dlg_layout)
def __init__(self, parent=None): super(OfflineDialog, self).__init__(parent) self.pagetitle = 'Offline Back Up' stylesheet = Valid().background() + Valid().font() self.hold_data = {} self.tree = QTreeWidget() self.tree.setHeaderLabel("Choose Sessions to Back-up") self.tree.headerItem().setText(0, 'Name') #self.tree.setStyleSheet(treeStyleSheet) arr = Db().selectn('session','', 5) if arr and len(arr) > 0: for val in arr: child = QTreeWidgetItem(self.tree) child.setFlags(child.flags() | Qt.ItemIsUserCheckable) child.setText(0, str(val['name']).upper()) self.hold_data[val['id']] = child child.setCheckState(0, Qt.Checked) self.pb = QPushButton() self.pb.setObjectName("Add") self.pb.setText("Save") self.pb1 = QPushButton() self.pb1.setObjectName("Cancel") self.pb1.setText("Close") hbo = QHBoxLayout() hbo.addWidget(self.pb1) hbo.addStretch() hbo.addWidget(self.pb) groupBox2 = QGroupBox('') groupBox2.setLayout(hbo) grid = QGridLayout() grid.addWidget(self.tree, 0, 0) grid.addWidget(groupBox2, 1, 0) self.setLayout(grid) self.connect(self.pb, SIGNAL("clicked()"), lambda: self.button_click()) self.connect(self.pb1, SIGNAL("clicked()"), lambda: self.button_close(self)) self.setStyleSheet(stylesheet) #self.setWindowIcon(QIcon(self.titleIcon)) self.setWindowTitle(self.pagetitle)