本文整理匯總了Python中qgis.gui.QgsMapLayerComboBox.setFixedWidth方法的典型用法代碼示例。如果您正苦於以下問題:Python QgsMapLayerComboBox.setFixedWidth方法的具體用法?Python QgsMapLayerComboBox.setFixedWidth怎麽用?Python QgsMapLayerComboBox.setFixedWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.gui.QgsMapLayerComboBox
的用法示例。
在下文中一共展示了QgsMapLayerComboBox.setFixedWidth方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from qgis.gui import QgsMapLayerComboBox [as 別名]
# 或者: from qgis.gui.QgsMapLayerComboBox import setFixedWidth [as 別名]
class LatticeData:
"""QGIS Plugin Implementation."""
def __init__(self, iface):
"""Constructor.
:param iface: An interface instance that will be passed to this class
which provides the hook by which you can manipulate the QGIS
application at run time.
:type iface: QgsInterface
"""
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'LatticeData_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Create the dialog (after translation) and keep reference
self.dlg = LatticeDataDialog()
# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&Lattice Data')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'LatticeData')
self.toolbar.setObjectName(u'LatticeData')
"""buttons connected with methods"""
"""comboBoxLayer"""
self.cmbBoxSelectLayer = QgsMapLayerComboBox(self.dlg)
self.cmbBoxSelectLayer.setFixedWidth(200)
self.cmbBoxSelectLayer.move(140,20)
self.cmbBoxSelectLayer.setFilters(QgsMapLayerProxyModel.PolygonLayer)
self.cmbBoxSelectLayer.enabledChange(False)
self.cmbBoxSelectLayer.currentIndexChanged[str].connect(self.changeCurrentIndex)
"""radioButtonSelectMatrix"""
self.dlg.rdButton_nm.clicked.connect(self.activateNewMatrix)
self.dlg.rdButton_sm.clicked.connect(self.activateSelectMatrix)
"""radioButtonSelectMatrixWeight"""
self.dlg.rdButtonContW.clicked.connect(self.radioContW)
self.dlg.rdButtonDisW.clicked.connect(self.radioDisW)
self.dlg.rdButtonKNW.clicked.connect(self.radioKNW)
"""sliderdistance"""
self.dlg.horizontalSlider.setMinimum(0)
self.dlg.horizontalSlider.setMaximum(100)
self.dlg.horizontalSlider.setSingleStep(1)
self.dlg.horizontalSlider.valueChanged[int].connect(self.changeValueSlider)
"""Buttons and connects"""
self.dlg.btnSave.clicked.connect(self.generate_matrix)
self.dlg.checkBox.stateChanged.connect(self.activatemoranI)
self.dlg.cmbBoxSelectField.currentIndexChanged[str].connect(self.moranI)
self.dlg.btnMoranI.clicked.connect(self.grafico)
# noinspection PyMethodMayBeStatic
def tr(self, message):
"""Get the translation for a string using Qt translation API.
We implement this ourselves since we do not inherit QObject.
:param message: String for translation.
:type message: str, QString
:returns: Translated version of message.
:rtype: QString
"""
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
return QCoreApplication.translate('LatticeData', message)
def add_action(
self,
icon_path,
text,
callback,
enabled_flag=True,
add_to_menu=True,
#.........這裏部分代碼省略.........