Esempio n. 1
0
    def select_data_entry(self):
        """
        Open the form selection widget to allow the user to pick the active capture form.
        """
        def showformerror(form):
            pass

        def actions():
            for form in self.project.forms:
                if not self.form_valid_for_capture(form):
                    continue

                action = form.createuiaction()
                valid, failreasons = form.valid
                if not valid:
                    roam.utils.warning("Form {} failed to load".format(form.label))
                    roam.utils.warning("Reasons {}".format(failreasons))
                    action.triggered.connect(partial(showformerror, form))
                else:
                    action.triggered.connect(partial(self.load_form, form))
                yield action

        formpicker = PickActionDialog(msg="Select data entry form", wrap=5)
        formpicker.addactions(actions())
        formpicker.exec_()
Esempio n. 2
0
    def _show_more_actions(self):
        dlg = PickActionDialog()
        self.navigateAction.setEnabled(GPS.isConnected)
        if not GPS.isConnected:
            self.navigateAction.setText("Navigate To.. (No GPS)")
        else:
            self.navigateAction.setText("Navigate To..")

        dlg.addactions([self.expandAction, self.navigateAction])
        dlg.exec_()
Esempio n. 3
0
    def selectdataentry(self):
        forms = self.project.forms
        formpicker = PickActionDialog(msg="Select data entry form")
        for form in forms:
            action = form.createuiaction()
            valid, failreasons = form.valid
            if not valid:
                roam.utils.warning("Form {} failed to load".format(form.label))
                roam.utils.warning("Reasons {}".format(failreasons))
                action.triggered.connect(partial(self.showformerror, form))
            else:
                action.triggered.connect(partial(self.loadform, form))
            formpicker.addAction(action)

        formpicker.exec_()
Esempio n. 4
0
    def select_data_entry(self):
        """
        Open the form selection widget to allow the user to pick the active capture form.
        """
        def showformerror(form):
            pass

        def actions():
            for form in self.project.forms:
                if not self.form_valid_for_capture(form):
                    continue

                action = form.createuiaction()
                valid, failreasons = form.valid
                if not valid:
                    roam.utils.warning("Form {} failed to load".format(
                        form.label))
                    roam.utils.warning("Reasons {}".format(failreasons))
                    action.triggered.connect(partial(showformerror, form))
                else:
                    action.triggered.connect(partial(self.load_form, form))
                yield action

        formpicker = PickActionDialog(msg="Select data entry form", wrap=5)
        formpicker.addactions(actions())
        formpicker.exec_()
Esempio n. 5
0
    def toggle_raster_layers(self) -> None:
        """
        Toggle all raster layers on or off.
        """
        # Freeze the canvas to save on UI refresh
        dlg = PickActionDialog(msg="Raster visibility")
        actions = [
            (":/icons/raster_0", "Off", partial(self._set_basemaps_opacity,
                                                0), "photo_off"),
            (":/icons/raster_25", "25%",
             partial(self._set_basemaps_opacity, .25), "photo_25"),
            (":/icons/raster_50", "50%",
             partial(self._set_basemaps_opacity, .50), "photo_50"),
            (":/icons/raster_75", "75%",
             partial(self._set_basemaps_opacity, .75), "photo_75"),
            (":/icons/raster_100", "100%",
             partial(self._set_basemaps_opacity, 1), "photo_100"),
        ]

        # ":/icons/raster_100"), "100%", self, triggered=partial(self._set_raster_layer_value, 1),
        #                                                objectName="photo_100")
        dialog_actions = []
        for action in actions:
            icon = QIcon(action[0])
            qaction = QAction(icon,
                              action[1],
                              self,
                              triggered=action[2],
                              objectName=action[3])
            dialog_actions.append(qaction)

        dlg.addactions(dialog_actions)
        dlg.exec_()
Esempio n. 6
0
    def _show_more_actions(self):
        dlg = PickActionDialog()
        self.navigateAction.setEnabled(GPS.isConnected)
        if not GPS.isConnected:
            self.navigateAction.setText("Navigate To.. (No GPS)")
        else:
            self.navigateAction.setText("Navigate To..")

        dlg.addactions([self.expandAction, self.navigateAction])
        dlg.exec_()
Esempio n. 7
0
    def cancelform(self, *args):
        dlg = PickActionDialog(msg="Discard form changes?")
        self.expandAction = QAction(QIcon(":/icons/expand"), "Expand Panel",
                                    self)
        discardaction = QAction("Discard", self, triggered=self._cancel_form)
        discardaction.setObjectName("discard")
        noaction = QAction("No", self)

        dlg.addactions([noaction, discardaction])
        dlg.exec_()
Esempio n. 8
0
    def selectdataentry(self):
        forms = self.project.forms
        formpicker = PickActionDialog(msg="Select data entry form")
        for form in forms:
            action = form.createuiaction()
            valid, failreasons = form.valid
            if not valid:
                roam.utils.warning("Form {} failed to load".format(form.label))
                roam.utils.warning("Reasons {}".format(failreasons))
                action.triggered.connect(partial(self.showformerror, form))
            else:
                action.triggered.connect(partial(self.loadform, form))
            formpicker.addAction(action)

        formpicker.exec_()
Esempio n. 9
0
    def toggleRasterLayers(self):
        """
        Toggle all raster layers on or off.
        """
        # Freeze the canvas to save on UI refresh
        dlg = PickActionDialog(msg="Raster visibility")
        actions = [
            QAction(QIcon(":/icons/raster_0"), "Off", self, triggered=partial(self._set_raster_layer_value, 0),
                    objectName="photo_off"),
            QAction(QIcon(":/icons/raster_25"), "25%", self, triggered=partial(self._set_raster_layer_value, .25),
                    objectName="photo_25"),
            QAction(QIcon(":/icons/raster_50"), "50%", self, triggered=partial(self._set_raster_layer_value, .50),
                    objectName="photo_50"),
            QAction(QIcon(":/icons/raster_75"), "75%", self, triggered=partial(self._set_raster_layer_value, .75),
                    objectName="photo_75"),
            QAction(QIcon(":/icons/raster_100"), "100%", self, triggered=partial(self._set_raster_layer_value, 1),
                    objectName="photo_100")
        ]

        dlg.addactions(actions)
        dlg.exec_()
Esempio n. 10
0
 def showpicker(self):
     actionpicker = PickActionDialog(msg="Select image source")
     actionpicker.addactions(self.actions)
     actionpicker.exec_()
Esempio n. 11
0
 def showpicker(self):
     actionpicker = PickActionDialog(msg="Select attachment")
     actionpicker.addactions(self.actions)
     actionpicker.exec_()
Esempio n. 12
0
 def showpicker(self):
     actionpicker = PickActionDialog(msg="Select image source")
     actionpicker.addactions(self.actions)
     actionpicker.exec_()
Esempio n. 13
0
 def showpicker(self):
     actionpicker = PickActionDialog(msg="Select attachment")
     actionpicker.addactions(self.actions)
     actionpicker.exec_()