Ejemplo n.º 1
0
    def __init__(self, connect):
        """
        This one should contain:

        Two widgets and two layouts (separate classes.

        Widget 1 contains the comboboxes and fields for producing the parameter names.

            part 1: parameter names
                option 1:
                less flexible. Choosing a table and a pre-created list of parameters/units will appear using select distinct parameter, unit from ...
                option 2:
                choosing table, then column, then distinct parameter, then table, column and distinct unit.
                This could create bad combinations of parameters and units. and takes up more space.
                Maybe these could be set using a separate pop-up dialog.

                qlineedit: final_parameter_name. This is the one that really matters. The other fields are only for help
                qcombobox: inputtype?
                qcombobox: color?

            part 2: obsids.
                obsidnames (obsid.suffix)
                sublocation-names (obsid.suffix.groupname)
                This, two qlineedits, obsid-suffix, and sublocation-suffix. (Which can be unequal or equal.

        Widget 2 contains all the obsids which will be under the first widget.

        Maybe a vertical splitter can be used to hide parts.

        QCombobox

        """
        #Widget list:

        self._input_type = import_fieldlogger.default_combobox(editable=True)
        self._hint = PyQt4.QtGui.QLineEdit()
        self._location_suffix = PyQt4.QtGui.QLineEdit()
        self._sublocation_suffix = PyQt4.QtGui.QLineEdit()
        self._final_parameter_name = PyQt4.QtGui.QLineEdit()
        self.obsid_list = CopyPasteDeleteableQListWidget()
        self.paste_from_selection_button = PyQt4.QtGui.QPushButton(u'Paste obs_points selection')
        #------------------------------------------------------------------------
        self._input_type.addItems([u'numberDecimal|numberSigned', u'numberDecimal', u'numberSigned', u'text'])
        self._input_type.setToolTip(u'(mandatory)\nDecides the keyboard layout in the Fieldlogger app.')
        self._hint.setToolTip(u'(optional)\nHint given to the Fieldlogger user for the parameter. Ex: "depth to water"')
        #-------------------------------------------------------------------------------------

        self._location_suffix.setToolTip(u'(optional)\nFieldlogger NAME = obsid.SUFFIX\nUseful for separating projects or databases\nex: suffix = 1234 --> obsid.1234')
        self._sublocation_suffix.setToolTip(u'(optional)\nFieldlogger sub-location = obsid.SUFFIX\nUseful for separating parameters into groups for the user.\nParameters sharing the same sub-location will be shown together\n ex: suffix 1234.quality --> obsid.1234.quality')
        self._final_parameter_name.setToolTip(u'(mandatory)\nFieldlogger parameter name. Ex: parameter.unit')
        #-------------------------------------------------------------------------------------
        self.obsid_list.setSelectionMode(PyQt4.QtGui.QAbstractItemView.ExtendedSelection)
        connect(self.paste_from_selection_button, PyQt4.QtCore.SIGNAL("clicked()"),
                         lambda : self.obsid_list.paste_data(utils.get_selected_features_as_tuple('obs_points')))
        connect(self._location_suffix, PyQt4.QtCore.SIGNAL("textChanged(const QString&)"),
                         lambda : self.set_sublocation_suffix(self.location_suffix))
Ejemplo n.º 2
0
    def __init__(self, connect):
        """
        This one should contain:

        Two widgets and two layouts (separate classes.

        Widget 1 contains the comboboxes and fields for producing the parameter names.

            part 1: parameter names
                option 1:
                less flexible. Choosing a table and a pre-created list of parameters/units will appear using select distinct parameter, unit from ...
                option 2:
                choosing table, then column, then distinct parameter, then table, column and distinct unit.
                This could create bad combinations of parameters and units. and takes up more space.
                Maybe these could be set using a separate pop-up dialog.

                qlineedit: final_parameter_name. This is the one that really matters. The other fields are only for help
                qcombobox: inputtype?
                qcombobox: color?

            part 2: obsids.
                obsidnames (obsid.suffix)
                sublocation-names (obsid.suffix.groupname)
                This, two qlineedits, obsid-suffix, and sublocation-suffix. (Which can be unequal or equal.

        Widget 2 contains all the obsids which will be under the first widget.

        Maybe a vertical splitter can be used to hide parts.

        QCombobox

        """
        #Widget list:

        self._location_suffix = PyQt4.QtGui.QLineEdit()
        self._sublocation_suffix = PyQt4.QtGui.QLineEdit()
        self._parameter_list = CopyPasteDeleteableQListWidget(keep_sorted=False)
        self._obsid_list = CopyPasteDeleteableQListWidget(keep_sorted=True)
        self.paste_from_selection_button = PyQt4.QtGui.QPushButton(u'Paste obs_points selection')
        #------------------------------------------------------------------------
        self._location_suffix.setToolTip(u"""(optional)\n""" +
                                         u"""Fieldlogger NAME = obsid.SUFFIX\n""" +
                                         u"""Useful for separating projects or databases\n""" +
                                         u"""ex: suffix = 1234 --> obsid.1234""")
        self._sublocation_suffix.setToolTip(u"""(optional)\n""" +
                                            u"""Fieldlogger sub-location = obsid.SUFFIX\n""" +
                                            u"""Useful for separating parameters into groups for the user.\n""" +
                                            u"""Parameters sharing the same sub-location will be shown together\n""" +
                                            u"""ex: suffix 1234.quality --> obsid.1234.quality""")
        self._parameter_list.setToolTip(u"""Copy and paste input fields from "Create Input Fields" to this box\n""" +
                                        u"""or from/to other input field boxes.\n""" +
                                        u"""The input fields in Fieldlogger will appear in the same order as in\n""" +
                                        u"""this list.\n""" +
                                        u"""The topmost input field will be the first selected input field when\n""" +
                                        u"""the user enters the input fields in Fieldlogger.""")
        self._obsid_list.setToolTip(u"""Add obsids to this box by selecting obsids from the table "obs_points"\n""" +
                                    u"""using it's attribute table or select from map.\n""" +
                                    u"""Then click the button "Paste obs_points selection"\n""" +
                                    u"""Copy and paste obsids between Locations boxes""")
        #-------------------------------------------------------------------------------------
        connect(self.paste_from_selection_button, PyQt4.QtCore.SIGNAL("clicked()"),
                         lambda : self._obsid_list.paste_data(utils.get_selected_features_as_tuple('obs_points')))