コード例 #1
0
ファイル: sdrcdatacapture.py プロジェクト: spanc29/qmap
    def createFormButtons(self, layers):
        """
            Create buttons for each form that is definded
        """
        layerstoForms = {}

        # Remove all the old buttons
        for action in self.actions:
            self.toolbar.removeAction(action)

        userForms = forms.getForms()

        for form in userForms:
            try:
                layer = layers[form.layerName()]
                icon = form.icon()
                action = AddAction(form.formName(), self.iface, form, layer, icon)
                self.toolbar.insertAction(self.editAction, action)
                self.actionGroup.addAction(action)
                self.actions.append(action)
                layerstoForms[layer] = form
            except KeyError:
                log("Couldn't find layer for form %s" % form.layerName())

        self.editAction.setLayersForms(layerstoForms)
コード例 #2
0
ファイル: qmap.py プロジェクト: vadimshenikov/qmap
    def createFormButtons(self, layers):
        """
            Create buttons for each form that is definded
        """
        layerstoForms = {}

        # Remove all the old buttons
        for action in self.actions:
            self.toolbar.removeAction(action)

        for layername, form in forms.getForms().iteritems():
            try:
                layer = layers[layername]    
            except KeyError:
                log("Couldn't find layer for form %s" % layername)
                continue           
            text = "New %s" % form.nameforform(layername)
            action = (AddAction(text, self.iface,
                               form, layer, form.icon()))
            self.toolbar.insertAction(self.editingmodeaction, action)
            showgpstools = (functools.partial(self.extraaddtoolbar.showToolbar, 
                                             action,
                                             None))
            action.toggled.connect(showgpstools)
            self.actionGroup.addAction(action)
            self.actions.append(action)
            layerstoForms[layer] = form


        QMap.layerformmap = layerstoForms
コード例 #3
0
ファイル: formsTest.py プロジェクト: NathanW2/qmap
 def testGetFormsReturnsCorrectNumber(self):
     listofforms = forms.getForms()
     self.assertEqual(1, len(listofforms))
コード例 #4
0
ファイル: formsTest.py プロジェクト: NathanW2/qmap
    def testFormsShouldImportCorrectlyAndGetName(self):
        listofforms = forms.getForms()
        loaded = forms.loadFormModule(listofforms[0])

        self.assertEqual("Water Form", loaded.name())
コード例 #5
0
ファイル: formsTest.py プロジェクト: NathanW2/qmap
 def testFormShouldHaveCorrectName(self):
     listofforms = forms.getForms()
     self.assertEqual("formWater", listofforms[0].moduleName)