Exemple #1
0
    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)
Exemple #2
0
    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
Exemple #3
0
 def testGetFormsReturnsCorrectNumber(self):
     listofforms = forms.getForms()
     self.assertEqual(1, len(listofforms))
Exemple #4
0
    def testFormsShouldImportCorrectlyAndGetName(self):
        listofforms = forms.getForms()
        loaded = forms.loadFormModule(listofforms[0])

        self.assertEqual("Water Form", loaded.name())
Exemple #5
0
 def testFormShouldHaveCorrectName(self):
     listofforms = forms.getForms()
     self.assertEqual("formWater", listofforms[0].moduleName)