def __init__(self, parent=None): QDialog.__init__(self, parent) # Destroying the C++ object right after closing the dialog box, # otherwise it may be garbage-collected in another QThread # (e.g. the editor's analysis thread in Spyder), thus leading to # a segmentation fault on UNIX or an application crash on Windows self.setAttribute(Qt.WA_DeleteOnClose) self.contents_widget = QListWidget() self.contents_widget.setMovement(QListView.Static) self.contents_widget.setSpacing(1) bbox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Apply |QDialogButtonBox.Cancel) self.apply_btn = bbox.button(QDialogButtonBox.Apply) self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()")) self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()")) self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"), self.button_clicked) self.pages_widget = QStackedWidget() self.connect(self.pages_widget, SIGNAL("currentChanged(int)"), self.current_page_changed) self.connect(self.contents_widget, SIGNAL("currentRowChanged(int)"), self.pages_widget.setCurrentIndex) self.contents_widget.setCurrentRow(0) hsplitter = QSplitter() hsplitter.addWidget(self.contents_widget) hsplitter.addWidget(self.pages_widget) btnlayout = QHBoxLayout() btnlayout.addStretch(1) btnlayout.addWidget(bbox) vlayout = QVBoxLayout() vlayout.addWidget(hsplitter) vlayout.addLayout(btnlayout) self.setLayout(vlayout) self.setWindowTitle(_("Preferences")) self.setWindowIcon(get_icon("configure.png"))
def __init__(self, parent=None): QDialog.__init__(self, parent) # Destroying the C++ object right after closing the dialog box, # otherwise it may be garbage-collected in another QThread # (e.g. the editor's analysis thread in Spyder), thus leading to # a segmentation fault on UNIX or an application crash on Windows self.setAttribute(Qt.WA_DeleteOnClose) self.contents_widget = QListWidget() self.contents_widget.setMovement(QListView.Static) self.contents_widget.setSpacing(1) bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply | QDialogButtonBox.Cancel) self.apply_btn = bbox.button(QDialogButtonBox.Apply) self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()")) self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()")) self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"), self.button_clicked) self.pages_widget = QStackedWidget() self.connect(self.pages_widget, SIGNAL("currentChanged(int)"), self.current_page_changed) self.connect(self.contents_widget, SIGNAL("currentRowChanged(int)"), self.pages_widget.setCurrentIndex) self.contents_widget.setCurrentRow(0) hsplitter = QSplitter() hsplitter.addWidget(self.contents_widget) hsplitter.addWidget(self.pages_widget) btnlayout = QHBoxLayout() btnlayout.addStretch(1) btnlayout.addWidget(bbox) vlayout = QVBoxLayout() vlayout.addWidget(hsplitter) vlayout.addLayout(btnlayout) self.setLayout(vlayout) self.setWindowTitle(_("Preferences")) self.setWindowIcon(get_icon("configure.png"))
def setup_page(self): """ Setup the page of the survey widget """ population_group = QGroupBox(_("Alternatives population data")) population_bg = QButtonGroup(self) population_label = QLabel(_("Location of population data")) country_default_radio = self.create_radiobutton( _("Use country default population data"), 'use_default', False, tip=_("Use country default population data"), button_group=population_bg) population_radio = self.create_radiobutton( _("The following file"), # le fichier suivant", 'enable', True, _("population data file for micrsosimulation" ), # "Fichier de données pour la microsimulation", button_group=population_bg) population_file = self.create_browsefile("", 'data_file', filters='*.h5') self.connect(country_default_radio, SIGNAL("toggled(bool)"), population_file.setDisabled) self.connect(population_radio, SIGNAL("toggled(bool)"), population_file.setEnabled) population_file_layout = QHBoxLayout() population_file_layout.addWidget(population_radio) population_file_layout.addWidget(population_file) population_layout = QVBoxLayout() population_layout.addWidget(population_label) population_layout.addWidget(country_default_radio) population_layout.addLayout(population_file_layout) population_group.setLayout(population_layout) vlayout = QVBoxLayout() vlayout.addWidget(population_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): """ Setup the page of the survey widget """ profiles_group = QGroupBox(_("Alternatives profiles data")) profiles_bg = QButtonGroup(self) profiles_label = QLabel(_("Location of profiles data")) country_default_radio = self.create_radiobutton(_("Use country default profiles data"), 'use_default', False, tip = _("Use country default profiles data"), button_group = profiles_bg) profiles_radio = self.create_radiobutton(_("The following file"), # le fichier suivant", 'enable', True, _("profiles data file for micrsosimulation"), # "Fichier de données pour la microsimulation", button_group=profiles_bg) profiles_file = self.create_browsefile("", 'data_file', filters='*.h5') self.connect(country_default_radio, SIGNAL("toggled(bool)"), profiles_file.setDisabled) self.connect(profiles_radio, SIGNAL("toggled(bool)"), profiles_file.setEnabled) profiles_file_layout = QHBoxLayout() profiles_file_layout.addWidget(profiles_radio) profiles_file_layout.addWidget(profiles_file) profiles_layout = QVBoxLayout() profiles_layout.addWidget(profiles_label) profiles_layout.addWidget(country_default_radio) profiles_layout.addLayout(profiles_file_layout) profiles_group.setLayout(profiles_layout) vlayout = QVBoxLayout() vlayout.addWidget(profiles_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent): QWidget.__init__(self, parent) layout = QHBoxLayout() row_nb = 14 cindex = 0 for child in dir(QStyle): if child.startswith('SP_'): if cindex == 0: col_layout = QVBoxLayout() icon_layout = QHBoxLayout() icon = get_std_icon(child) label = QLabel() label.setPixmap(icon.pixmap(32, 32)) icon_layout.addWidget( label ) icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) ) col_layout.addLayout(icon_layout) cindex = (cindex+1) % row_nb if cindex == 0: layout.addLayout(col_layout) self.setLayout(layout) self.setWindowTitle('Standard Platform Icons') self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
def setup_page(self): interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in QStyleFactory.keys()] choices = zip(styles, [style.lower() for style in styles]) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) newcb = self.create_checkbox vertdock_box = newcb(_("Vertical dockwidget title bars"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical dockwidget tabs"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and dockwidgets"), 'animated_docks') margin_box = newcb(_("Custom dockwidget margin:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) self.connect(margin_box, SIGNAL("toggled(bool)"), margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) interface_layout = QVBoxLayout() interface_layout.addWidget(style_combo) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addLayout(margins_layout) interface_group.setLayout(interface_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addStretch(1) self.setLayout(vlayout)