def setEditability(self):
     """ 
     Set the editability of each user input field embedded with the feature 
     form based on the user supplied address class
     """ 
     
     UiUtility.setEditability(self)
 def __init__( self, parent=None, controller=None ):
     QWidget.__init__( self, parent )
     self.setupUi(self)
     UiUtility.setFormCombos(self)
     self.uGetRclToolButton.clicked.connect(self.getRcl) 
 
     self.setController( controller )
Beispiel #3
0
    def setEditability(self):
        """
        Set the editability of each user input field embedded with the feature 
        form based on the user supplied address class
        """

        UiUtility.setEditability(self, self.parent)
Beispiel #4
0
    def __init__(self, controller=None):
        """
        Make form button and input field connections
        
        @param controller: instance of the plugins controller
        @type  controller: AimsUI.AimsClient.Gui.Controller
        """

        QWidget.__init__(self)
        self.setupUi(self)

        getRclIcon = QIcon()
        getRclIcon.addPixmap(
            QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/selectrcl.png"),
            QIcon.Normal, QIcon.On)
        self.uGetRclToolButton.setIcon(getRclIcon)

        self.setController(controller)
        self._iface = self._controller.iface
        self._layerManager = self._controller._layerManager
        self.highlight = self._controller.highlighter
        self.coords = None
        self.feature = None

        #         # Val Ref, Cert Title and App have been temp taken out of scope
        hide = (self.uExternalObjectId, self.uExtObjectIdScheme,
                self.lExtObjectIdScheme, self.lExternalObjectId)
        for uiElement in hide:
            uiElement.hide()

        self.wAddObj.hide()

        # Make connections
        self.uAddressType.currentIndexChanged.connect(self.setEditability)
        self.buttonAO.clicked.connect(self.showAddObj)
        # connect dynamic address splitter components
        self.uFullNum.textEdited.connect(self.fullNumChanged)

        partComponents = (self.uPrefix, self.uUnit, self.uBase, self.uBase,
                          self.uHigh, self.uAlpha)

        for com in partComponents:
            com.textEdited.connect(self.partNumChanged)

        self.uSubmitAddressButton.clicked.connect(self.submitAddress)
        self.uAbort.clicked.connect(self.closeDlg)
        self.uGetRclToolButton.clicked.connect(self.getRcl)
        self.af = {
            ft: FeatureFactory.getInstance(FEEDS['AC'])
            for ft in FeedType.reverse
        }

        # limit user inputs
        UiUtility.formMask(self)
        # set combo box defaults
        UiUtility.setFormCombos(self)
        # set addressType to trigger currentIndexChanged
        self.uAddressType.setCurrentIndex(
            QComboBox.findText(self.uAddressType, 'Road'))
Beispiel #5
0
    def fullNumChanged(self, newnumber):
        """
        When the full number input is modified, split it into and
        update its individual components 
        
        @param newnumber: user input to uFullNum
        @type  newnumber: string
        """

        UiUtility.fullNumChanged(self, newnumber)
 def fullNumChanged(self, newnumber):
     """
     When the full number input is modified, split it into and
     update its individual components 
     
     @param newnumber: user input to uFullNum
     @type  newnumber: string
     """
     
     UiUtility.fullNumChanged(self, newnumber)
    def __init__(self, controller = None):
        """
        Make form button and input field connections
        
        @param controller: instance of the plugins controller
        @type  controller: AimsUI.AimsClient.Gui.Controller
        """
        
        QWidget.__init__( self )
        self.setupUi(self)
        
        getRclIcon = QIcon()
        getRclIcon.addPixmap(QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/selectrcl.png"), QIcon.Normal, QIcon.On)
        self.uGetRclToolButton.setIcon(getRclIcon)
        
        self.setController( controller )
        self._iface = self._controller.iface
        self._layerManager = self._controller._layerManager
        self.highlight = self._controller.highlighter
        self.coords = None
        self.feature = None
        
#         # Val Ref, Cert Title and App have been temp taken out of scope
        hide = (self.uExternalObjectId, self.uExtObjectIdScheme, 
                 self.lExtObjectIdScheme,  self.lExternalObjectId)
        for uiElement in hide:
            uiElement.hide()
            
        self.wAddObj.hide()
        
        # Make connections
        self.uAddressType.currentIndexChanged.connect(self.setEditability)
        self.buttonAO.clicked.connect(self.showAddObj)
        # connect dynamic address splitter components 
        self.uFullNum.textEdited.connect(self.fullNumChanged)
        
        partComponents = (self.uPrefix,self.uUnit, self.uBase, 
                          self.uBase, self.uHigh, self.uAlpha )
        
        for com in partComponents:
            com.textEdited.connect(self.partNumChanged)
         
        self.uSubmitAddressButton.clicked.connect(self.submitAddress)
        self.uAbort.clicked.connect(self.closeDlg)
        self.uGetRclToolButton.clicked.connect(self.getRcl)
        self.af = {ft:FeatureFactory.getInstance(FEEDS['AC']) for ft in FeedType.reverse}  
         
        # limit user inputs
        UiUtility.formMask(self)
        # set combo box defaults
        UiUtility.setFormCombos(self)
        # set addressType to trigger currentIndexChanged
        self.uAddressType.setCurrentIndex(QComboBox.findText(self.uAddressType,'Road'))
 def submitAddress(self):
     ''' take users input from form and submit to AIMS API '''
     # Run through the setters
     UiUtility.formToaddObj(self)
     # load address to AIMS Via API
     payload = self.feature.aimsObject()
     # Capture the returned response (response distilled down to list of errors)
     valErrors = self._controller.updateFeature(payload)
     
     if len(valErrors) == 0:
         self.closeDlg()
     else:
         QMessageBox.warning(iface.mainWindow(),"Create Address Point", valErrors)
    def __init__(self, parent=None, controller=None):
        """
        Intialise Queue Feature UI components
        """

        QWidget.__init__(self, parent)
        self.setupUi(self)

        #icons for buttons
        moveIcon = QIcon()
        moveIcon.addPixmap(
            QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/moveaddress.png"),
            QIcon.Normal, QIcon.On)
        self.uUpdatePosButton.setIcon(moveIcon)

        getRclIcon = QIcon()
        getRclIcon.addPixmap(
            QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/selectrcl.png"),
            QIcon.Normal, QIcon.On)
        self.uGetRclToolButton.setIcon(getRclIcon)

        self.feature = None
        self.featureId = None
        UiUtility.setFormCombos(self)
        self.uGetRclToolButton.clicked.connect(self.getRcl)
        self.uUpdatePosButton.clicked.connect(self.updatePosition)
        self.setController(controller)
        self.uAddressType.currentIndexChanged.connect(self.setEditability)
        self.setStyle()

        # limit user inputs
        UiUtility.formMask(self)

        #Ext Object temp taken out of scope
        hide = (self.uExternalObjectId, self.uExtObjectIdScheme,
                self.lExtObjectIdScheme, self.lExternalObjectId)

        for uiElement in hide:
            uiElement.hide()

        # connect all editing ui elements to
        for uiElement, v in UiUtility.uiObjMappings.iteritems():
            if isinstance(getattr(self, uiElement), QLineEdit):
                getattr(self,
                        uiElement).textEdited.connect(getattr(self, v[1]))
            elif isinstance(getattr(self, uiElement), QComboBox):
                getattr(self, uiElement).activated.connect(getattr(self, v[1]))
    def currentFeatureToUi(self, feature):
        """
        Populate the Edit Feature Form when the user selects an AIMS Feature 
        
        @param feature: AIMS Feature
        @type  feature: AIMSDataManager.Address()

        AIMSDataManager.Address
        """
        
        if feature:
            self.feature = feature
            UiUtility.featureToUi(self, 'r'+self.feature._changeType)
            if self.featureId == self.feature._changeId:
                self.reinstateEdits()
            else:
                self.clearEdits()
            self.featureId = self.feature._changeId
    def currentFeatureToUi(self, feature):
        """
        Populate the Edit Feature Form when the user selects an AIMS Feature 
        
        @param feature: AIMS Feature
        @type  feature: AIMSDataManager.Address()

        AIMSDataManager.Address
        """

        if feature:
            self.feature = feature
            UiUtility.featureToUi(self, 'r' + self.feature._changeType)
            if self.featureId == self.feature._changeId:
                self.reinstateEdits()
            else:
                self.clearEdits()
            self.featureId = self.feature._changeId
 def updateFeature(self):
     """
     Update the properties of a review queue item 
     """
     
     self.feature = self.currentReviewFeature()
     if not self.feature:
         return 
     if self.feature._changeType == 'Retire':
         UiUtility.raiseErrorMesg(self._iface, 'Retire Items cannot be updated')
         return
     if UiUtility.formCompleteness('update', self.uQueueEditor, self._iface ):        
         UiUtility.formToObj(self)
         respId = int(time.time())
         self.uidm.repairAddress(self.feature, respId)
         self._controller.RespHandler.handleResp(respId, FEEDS['AR'])
         self.feature = None
         self.uQueueEditor.featureId = 0
 def __init__( self, parent=None, controller=None ):
     """
     Intialise Queue Feature UI components
     """
     
     QWidget.__init__( self, parent )
     self.setupUi(self)
     
     #icons for buttons
     moveIcon = QIcon()
     moveIcon.addPixmap(QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/moveaddress.png"), QIcon.Normal, QIcon.On)
     self.uUpdatePosButton.setIcon(moveIcon)
     
     getRclIcon = QIcon()
     getRclIcon.addPixmap(QPixmap(":/plugins/QGIS-AIMS-Plugin/resources/selectrcl.png"), QIcon.Normal, QIcon.On)
     self.uGetRclToolButton.setIcon(getRclIcon)
     
     self.feature = None
     self.featureId = None
     UiUtility.setFormCombos(self)
     self.uGetRclToolButton.clicked.connect(self.getRcl)      
     self.uUpdatePosButton.clicked.connect(self.updatePosition)     
     self.setController(controller)
     self.uAddressType.currentIndexChanged.connect(self.setEditability)
     self.setStyle()
     
     # limit user inputs
     UiUtility.formMask(self)
     
     #Ext Object temp taken out of scope
     hide = (self.uExternalObjectId, self.uExtObjectIdScheme, 
              self.lExtObjectIdScheme,  self.lExternalObjectId
              )
            
     for uiElement in hide:
         uiElement.hide()
     
     # connect all editing ui elements to 
     for uiElement, v in UiUtility.uiObjMappings.iteritems():    
         if isinstance(getattr(self, uiElement), QLineEdit):
             getattr(self, uiElement).textEdited.connect(getattr(self, v[1]))
         elif isinstance(getattr(self, uiElement), QComboBox):
             getattr(self, uiElement).activated.connect(getattr(self, v[1]))
    def updateFeature(self):
        """
        Update the properties of a review queue item 
        """

        self.feature = self.currentReviewFeature()
        if not self.feature:
            return
        if self.feature._changeType == 'Retire':
            UiUtility.raiseErrorMesg(self._iface,
                                     'Retire Items cannot be updated')
            return
        if UiUtility.formCompleteness('update', self.uQueueEditor,
                                      self._iface):
            UiUtility.formToObj(self)
            respId = int(time.time())
            self.uidm.repairAddress(self.feature, respId)
            self._controller.RespHandler.handleResp(respId, FEEDS['AR'])
            self.feature = None
            self.uQueueEditor.featureId = 0
 def setFeature(self, parent, addInstance, coords = None):
     """
     Load the AIMS Feature to UI form
     
     @param parent: The tool that enable the form 
     @type  parent: string
     @param addInstance: The AIMS Address instance
     @type  addInstance: AIMSDataManager.Address
     @param coords: AIMS Feature's associated point
     @type  coords: QgsPoint
     """
     
     self.parent = parent
     self.feature = addInstance
     self.coords = coords
     self.uFullNum.setFocus()
     if parent == 'update':
         self.feature = self.af[FeedType.CHANGEFEED].cast(self.feature)
         UiUtility.featureToUi(self, parent) 
     elif parent == 'add' and self._controller._queues.uEditFeatureTab.uPersistRcl.isChecked():
         self._controller._rcltool.fillform()
 def __init__( self, parent, feature, layerManager, controller):
     QDialog.__init__( self, parent )  
     self.setupUi(self)
     self.iface = iface
     self.feature = feature
     self._layerManager = layerManager
     self._controller = controller
     
     # limit user inputs
     UiUtility.formMask(self)
     # set combo box defaults
     UiUtility.setFormCombos(self)
     
     self.uSubmitAddressButton.clicked.connect(self.submitAddress)
     self.uAbort.clicked.connect(self.closeDlg)
     self.rejected.connect(self.closeDlg)
     self.uFullNum.textEdited.connect(self.fullNumChanged)   
     self.uPrefix.textEdited.connect(self.partNumChanged)
     self.uUnit.textEdited.connect(self.partNumChanged)
     self.uBase.textEdited.connect(self.partNumChanged)
     self.uHigh.textEdited.connect(self.partNumChanged)
     self.uAlpha.textEdited.connect(self.partNumChanged)
     self.uGetRclToolButton.clicked.connect(self.getRcl)     
     # set forms feature values
     UiUtility.addObjToForm(self, self.feature)                   
     self.show()
Beispiel #17
0
    def setFeature(self, parent, addInstance, coords=None):
        """
        Load the AIMS Feature to UI form
        
        @param parent: The tool that enable the form 
        @type  parent: string
        @param addInstance: The AIMS Address instance
        @type  addInstance: AIMSDataManager.Address
        @param coords: AIMS Feature's associated point
        @type  coords: QgsPoint
        """

        self.parent = parent
        self.feature = addInstance
        self.coords = coords
        self.uFullNum.setFocus()
        if parent == 'update':
            self.feature = self.af[FeedType.CHANGEFEED].cast(self.feature)
            UiUtility.featureToUi(self, parent)
        elif parent == 'add' and self._controller._queues.uEditFeatureTab.uPersistRcl.isChecked(
        ):
            self._controller._rcltool.fillform()
    def submitAddress(self):
        """ 
        Submit the user inputed information to DataManager
        """
        if not UiUtility.formCompleteness(self.parent, self, self._iface ):
            return
        
        respId = int(time.time())

        if self.parent == 'add': 
            self.setPosition()   
            UiUtility.formToObj(self)
            self._controller.uidm.addAddress(self.feature, respId)
        
        elif self.parent == 'update': 
            UiUtility.formToObj(self)
            self.feature = self.af[FeedType.CHANGEFEED].cast(self.feature)            
            self._controller.uidm.updateAddress(self.feature, respId)
        
        # check the response 
        self._controller.RespHandler.handleResp(respId, FEEDS['AC'])
        # revert back to review tab 
        self._controller._queues.tabWidget.setCurrentIndex(1)
        self.hideMarker()
Beispiel #19
0
    def submitAddress(self):
        """ 
        Submit the user inputed information to DataManager
        """
        if not UiUtility.formCompleteness(self.parent, self, self._iface):
            return

        respId = int(time.time())

        if self.parent == 'add':
            self.setPosition()
            UiUtility.formToObj(self)
            self._controller.uidm.addAddress(self.feature, respId)

        elif self.parent == 'update':
            UiUtility.formToObj(self)
            self.feature = self.af[FeedType.CHANGEFEED].cast(self.feature)
            self._controller.uidm.updateAddress(self.feature, respId)

        # check the response
        self._controller.RespHandler.handleResp(respId, FEEDS['AC'])
        # revert back to review tab
        self._controller._queues.tabWidget.setCurrentIndex(1)
        self.hideMarker()
 def clearForm(self):
     UiUtility.clearForm(self)
 def fullNumChanged(self, newnumber):
     UiUtility.fullNumChanged(self, newnumber)
 def clearForm(self):
     UiUtility.clearForm(self)