当前位置: 首页>>代码示例>>Python>>正文


Python QgsMapLayerComboBox.setFixedWidth方法代码示例

本文整理汇总了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,
#.........这里部分代码省略.........
开发者ID:darodriguezalv,项目名称:LatticeData,代码行数:103,代码来源:LaticeData.py


注:本文中的qgis.gui.QgsMapLayerComboBox.setFixedWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。