本文整理匯總了Python中qgis.PyQt.QtWidgets.QGroupBox類的典型用法代碼示例。如果您正苦於以下問題:Python QGroupBox類的具體用法?Python QGroupBox怎麽用?Python QGroupBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QGroupBox類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: UserConfigDialog
class UserConfigDialog(QDialog):
def __init__(self, parent = None):
super(UserConfigDialog, self).__init__(parent)
self.user = None
self.email = None
self.initGui()
def initGui(self):
self.setWindowTitle('GeoGig user configuration')
verticalLayout = QVBoxLayout()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
usernameLabel = QLabel('Username')
self.usernameBox = QLineEdit()
horizontalLayout.addWidget(usernameLabel)
horizontalLayout.addWidget(self.usernameBox)
verticalLayout.addLayout(horizontalLayout)
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
emailLabel = QLabel('User email')
self.emailBox = QLineEdit()
horizontalLayout.addWidget(emailLabel)
horizontalLayout.addWidget(self.emailBox)
verticalLayout.addLayout(horizontalLayout)
self.groupBox = QGroupBox()
self.groupBox.setTitle("User data")
self.groupBox.setLayout(verticalLayout)
layout = QVBoxLayout()
layout.addWidget(self.groupBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
layout.addWidget(self.buttonBox)
self.setLayout(layout)
self.buttonBox.accepted.connect(self.okPressed)
self.buttonBox.rejected.connect(self.cancelPressed)
self.resize(400, 200)
def okPressed(self):
self.user = self.usernameBox.text()
self.email = self.emailBox.text()
self.close()
def cancelPressed(self):
self.user = None
self.email = None
self.close()
示例2: __init__
def __init__(self, parent=None, title=None):
QGroupBox.__init__(self)
self.setTitle(title)
self.selected_widget = None
self.deselected_widget = None
self._setupUI()
# connect actions
self.select_all_btn.clicked.connect(self._select_all)
self.deselect_all_btn.clicked.connect(self._deselect_all)
self.select_btn.clicked.connect(self._select)
self.deselect_btn.clicked.connect(self._deselect)
self.deselected_widget.itemDoubleClicked.connect(self._select)
self.selected_widget.itemDoubleClicked.connect(self._deselect)
示例3: initGui
def initGui(self):
self.setWindowTitle('Remote connection reference')
verticalLayout = QVBoxLayout()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
remoteLabel = QLabel('Remote connection')
self.remoteCombo = QComboBox()
self.remotes = self.repo.remotes()
self.remoteCombo.addItems(list(self.remotes.keys()))
self.remoteCombo.currentIndexChanged.connect(self.currentRemoteChanged)
horizontalLayout.addWidget(remoteLabel)
horizontalLayout.addWidget(self.remoteCombo)
verticalLayout.addLayout(horizontalLayout)
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
branchLabel = QLabel('Branch')
self.branchCombo = QComboBox()
self.branchCombo.addItems(self.repo.branches())
horizontalLayout.addWidget(branchLabel)
horizontalLayout.addWidget(self.branchCombo)
verticalLayout.addLayout(horizontalLayout)
self.groupBox = QGroupBox()
self.groupBox.setTitle("Remote connection info")
self.groupBox.setLayout(verticalLayout)
layout = QVBoxLayout()
layout.addWidget(self.groupBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
layout.addWidget(self.buttonBox)
self.setLayout(layout)
self.buttonBox.accepted.connect(self.okPressed)
self.buttonBox.rejected.connect(self.cancelPressed)
self.resize(400, 200)
示例4: initGui
def initGui(self):
self.setWindowTitle('GeoGig user configuration')
verticalLayout = QVBoxLayout()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
usernameLabel = QLabel('Username')
self.usernameBox = QLineEdit()
horizontalLayout.addWidget(usernameLabel)
horizontalLayout.addWidget(self.usernameBox)
verticalLayout.addLayout(horizontalLayout)
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
emailLabel = QLabel('User email')
self.emailBox = QLineEdit()
horizontalLayout.addWidget(emailLabel)
horizontalLayout.addWidget(self.emailBox)
verticalLayout.addLayout(horizontalLayout)
self.groupBox = QGroupBox()
self.groupBox.setTitle("User data")
self.groupBox.setLayout(verticalLayout)
layout = QVBoxLayout()
layout.addWidget(self.groupBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
layout.addWidget(self.buttonBox)
self.setLayout(layout)
self.buttonBox.accepted.connect(self.okPressed)
self.buttonBox.rejected.connect(self.cancelPressed)
self.resize(400, 200)
示例5: OptionsDialog
#.........這裏部分代碼省略.........
string += message.to_html()
string += footer
self.help_web_view.setHtml(string)
def restore_default_values_page(self):
"""Setup UI for default values setting."""
# Clear parameters so it doesn't add parameters when
# restore from changes.
if self.default_value_parameters:
self.default_value_parameters = []
if self.default_value_parameter_containers:
self.default_value_parameter_containers = []
for i in reversed(list(range(self.container_layout.count()))):
widget = self.container_layout.itemAt(i).widget()
if widget is not None:
widget.setParent(None)
default_fields = all_default_fields()
for field_group in all_field_groups:
settable_fields = []
for field in field_group['fields']:
if field not in default_fields:
continue
else:
settable_fields.append(field)
default_fields.remove(field)
if not settable_fields:
continue
# Create group box for each field group
group_box = QGroupBox(self)
group_box.setTitle(field_group['name'])
self.container_layout.addWidget(group_box)
parameters = []
for settable_field in settable_fields:
parameter = self.default_field_to_parameter(settable_field)
if parameter:
parameters.append(parameter)
parameter_container = ParameterContainer(
parameters,
description_text=field_group['description'],
extra_parameters=extra_parameter
)
parameter_container.setup_ui(must_scroll=False)
group_box_inner_layout = QVBoxLayout()
group_box_inner_layout.addWidget(parameter_container)
group_box.setLayout(group_box_inner_layout)
# Add to attribute
self.default_value_parameter_containers.append(parameter_container)
# Only show non-groups default fields if there is one
if len(default_fields) > 0:
for default_field in default_fields:
parameter = self.default_field_to_parameter(default_field)
if parameter:
self.default_value_parameters.append(parameter)
description_text = tr(
'In this options you can change the global default values for '
'these variables.')
parameter_container = ParameterContainer(
self.default_value_parameters,
示例6: restore_default_values_page
def restore_default_values_page(self):
"""Setup UI for default values setting."""
# Clear parameters so it doesn't add parameters when
# restore from changes.
if self.default_value_parameters:
self.default_value_parameters = []
if self.default_value_parameter_containers:
self.default_value_parameter_containers = []
for i in reversed(list(range(self.container_layout.count()))):
widget = self.container_layout.itemAt(i).widget()
if widget is not None:
widget.setParent(None)
default_fields = all_default_fields()
for field_group in all_field_groups:
settable_fields = []
for field in field_group['fields']:
if field not in default_fields:
continue
else:
settable_fields.append(field)
default_fields.remove(field)
if not settable_fields:
continue
# Create group box for each field group
group_box = QGroupBox(self)
group_box.setTitle(field_group['name'])
self.container_layout.addWidget(group_box)
parameters = []
for settable_field in settable_fields:
parameter = self.default_field_to_parameter(settable_field)
if parameter:
parameters.append(parameter)
parameter_container = ParameterContainer(
parameters,
description_text=field_group['description'],
extra_parameters=extra_parameter
)
parameter_container.setup_ui(must_scroll=False)
group_box_inner_layout = QVBoxLayout()
group_box_inner_layout.addWidget(parameter_container)
group_box.setLayout(group_box_inner_layout)
# Add to attribute
self.default_value_parameter_containers.append(parameter_container)
# Only show non-groups default fields if there is one
if len(default_fields) > 0:
for default_field in default_fields:
parameter = self.default_field_to_parameter(default_field)
if parameter:
self.default_value_parameters.append(parameter)
description_text = tr(
'In this options you can change the global default values for '
'these variables.')
parameter_container = ParameterContainer(
self.default_value_parameters,
description_text=description_text,
extra_parameters=extra_parameter
)
parameter_container.setup_ui(must_scroll=False)
self.other_group_box = QGroupBox(tr('Non-group fields'))
other_group_inner_layout = QVBoxLayout()
other_group_inner_layout.addWidget(parameter_container)
self.other_group_box.setLayout(other_group_inner_layout)
self.container_layout.addWidget(self.other_group_box)
# Add to attribute
self.default_value_parameter_containers.append(parameter_container)
示例7: RemoteRefDialog
class RemoteRefDialog(QDialog):
def __init__(self, repo, parent = None):
super(RemoteRefDialog, self).__init__(parent)
self.remote = None
self.branch = None
self.repo = repo
self.initGui()
def initGui(self):
self.setWindowTitle('Remote connection reference')
verticalLayout = QVBoxLayout()
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
remoteLabel = QLabel('Remote connection')
self.remoteCombo = QComboBox()
self.remotes = self.repo.remotes()
self.remoteCombo.addItems(list(self.remotes.keys()))
self.remoteCombo.currentIndexChanged.connect(self.currentRemoteChanged)
horizontalLayout.addWidget(remoteLabel)
horizontalLayout.addWidget(self.remoteCombo)
verticalLayout.addLayout(horizontalLayout)
horizontalLayout = QHBoxLayout()
horizontalLayout.setSpacing(30)
horizontalLayout.setMargin(0)
branchLabel = QLabel('Branch')
self.branchCombo = QComboBox()
self.branchCombo.addItems(self.repo.branches())
horizontalLayout.addWidget(branchLabel)
horizontalLayout.addWidget(self.branchCombo)
verticalLayout.addLayout(horizontalLayout)
self.groupBox = QGroupBox()
self.groupBox.setTitle("Remote connection info")
self.groupBox.setLayout(verticalLayout)
layout = QVBoxLayout()
layout.addWidget(self.groupBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
layout.addWidget(self.buttonBox)
self.setLayout(layout)
self.buttonBox.accepted.connect(self.okPressed)
self.buttonBox.rejected.connect(self.cancelPressed)
self.resize(400, 200)
def currentRemoteChanged(self):
self.branchCombo.clear()
remote = self.remoteCombo.currentText()
try:
repo = Repository(self.remotes[remote])
branches = repo.branches()
self.branchCombo.addItems(branches)
except:
QMessageBox.warning(self, "Wrong connection", "The selected remote connection is not available or not supported.\n"
"Only http-based connections are supported")
return
def okPressed(self):
remote = self.remoteCombo.currentText().strip()
if remote:
self.remote = remote
else:
QMessageBox.warning(self, "Missing value", "Please select a remote connection")
return
branch = self.branchCombo.currentText().strip()
if branch:
self.branch = branch
else:
QMessageBox.warning(self, "Missing value", "Please select a branch")
return
self.close()
def cancelPressed(self):
self.remote = None
self.branch = None
self.close()
示例8: __init__
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle(tr('DMS Point Tool'))
self.lat_D = QLineEdit()
self.lat_M = QLineEdit()
self.lat_S = QLineEdit()
self.lat_DM = QLineEdit()
self.lon_D = QLineEdit()
self.lon_M = QLineEdit()
self.lon_S = QLineEdit()
self.lon_DM = QLineEdit()
self.lat_M.textEdited.connect(self.lat_MS_edited)
self.lat_S.textEdited.connect(self.lat_MS_edited)
self.lat_DM.textEdited.connect(self.lat_DM_edited)
self.lon_M.textEdited.connect(self.lon_MS_edited)
self.lon_S.textEdited.connect(self.lon_MS_edited)
self.lon_DM.textEdited.connect(self.lon_DM_edited)
int_val = QIntValidator()
int_val.setBottom(0)
float_val = QDoubleValidator()
float_val.setBottom(0)
self.lat_D.setValidator(int_val)
self.lat_M.setValidator(int_val)
self.lat_S.setValidator(float_val)
self.lat_DM.setValidator(float_val)
self.lon_D.setValidator(int_val)
self.lon_M.setValidator(int_val)
self.lon_S.setValidator(float_val)
self.lon_DM.setValidator(float_val)
self.lat_NS = QComboBox()
self.lat_NS.addItem("N")
self.lat_NS.addItem("S")
self.lon_EW = QComboBox()
self.lon_EW.addItem("E")
self.lon_EW.addItem("W")
buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
lat_grp = QGroupBox(tr("Latitude"), self)
lat_grp.setStyleSheet(
"QGroupBox { font-weight: bold; color: #3c3c3c; } ")
lat_grid = QGridLayout()
lat_grid.addWidget(QLabel(tr("Degrees")), 0, 0)
lat_grid.addWidget(QLabel(tr("Minutes")), 0, 1)
lat_grid.addWidget(QLabel(tr("Seconds")), 0, 2)
lat_grid.addWidget(QLabel(tr("Direction")), 0, 3)
lat_grid.addWidget(self.lat_D, 1, 0)
lat_grid.addWidget(self.lat_M, 1, 1)
lat_grid.addWidget(self.lat_S, 1, 2)
lat_grid.addWidget(self.lat_NS, 1, 3)
lat_grid.addWidget(QLabel(tr("Decimal minutes")), 2, 1)
lat_grid.addWidget(self.lat_DM, 3, 1, 1, 2)
lat_grp.setLayout(lat_grid)
lon_grp = QGroupBox(tr("Longitude"), self)
lon_grp.setStyleSheet(
"QGroupBox { font-weight: bold; color: #3c3c3c; } ")
lon_grid = QGridLayout()
lon_grid.addWidget(QLabel(tr("Degrees")), 0, 0)
lon_grid.addWidget(QLabel(tr("Minutes")), 0, 1)
lon_grid.addWidget(QLabel(tr("Seconds")), 0, 2)
lon_grid.addWidget(QLabel(tr("Direction")), 0, 3)
lon_grid.addWidget(self.lon_D, 1, 0)
lon_grid.addWidget(self.lon_M, 1, 1)
lon_grid.addWidget(self.lon_S, 1, 2)
lon_grid.addWidget(self.lon_EW, 1, 3)
lon_grid.addWidget(QLabel(tr("Decimal minutes")), 2, 1)
lon_grid.addWidget(self.lon_DM, 3, 1, 1, 2)
lon_grp.setLayout(lon_grid)
vbox = QVBoxLayout()
vbox.addWidget(lat_grp)
vbox.addWidget(lon_grp)
vbox.addWidget(buttons)
self.setLayout(vbox)
示例9: getGroupBox
def getGroupBox(name, parent, widgets):
lyt = getLayout( parent, widgets )
gbx = QGroupBox(name, parent )
gbx.setLayout( lyt )
return gbx