Пример #1
0
    def __init__(self, parent, shape, title=_("Data properties")):
        self.parent = parent
        self.shape = shape

        label, etype = self._getLabel()
        self.etype = etype
        SimpleDialog.__init__(self, parent, title)

        self.element = Select(
            parent=self.panel,
            type=self.shape.GetPrompt(),
            validator=SimpleValidator(
                callback=self.ValidatorCallback))
        if shape.GetValue():
            self.element.SetValue(shape.GetValue())

        self.Bind(wx.EVT_BUTTON, self.OnOK, self.btnOK)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.btnCancel)
        if self.etype:
            self.typeSelect = ElementSelect(
                parent=self.panel,
                elements=[
                    'raster',
                    'raster_3d',
                    'vector'],
                size=globalvar.DIALOG_GSELECT_SIZE)
            self.typeSelect.Bind(wx.EVT_CHOICE, self.OnType)
            self.typeSelect.SetSelection(0)
            self.element.SetType('raster')

        if shape.GetValue():
            self.btnOK.Enable()

        self._layout()
        self.SetMinSize(self.GetSize())
Пример #2
0
    def _createSimplePanel(self):
        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self._firstRaster = gselect.Select(
            parent=panel,
            type='raster',
            size=globalvar.DIALOG_GSELECT_SIZE,
            validator=SimpleValidator(
                callback=self.ValidatorCallback))

        self._secondRaster = gselect.Select(
            parent=panel,
            type='raster',
            size=globalvar.DIALOG_GSELECT_SIZE,
            validator=SimpleValidator(
                callback=self.ValidatorCallback))
        sizer.Add(
            StaticText(
                panel,
                label=_("Name of top/left raster map:")),
            proportion=0,
            flag=wx.EXPAND | wx.ALL,
            border=5)
        sizer.Add(self._firstRaster, proportion=0,
                  flag=wx.EXPAND | wx.ALL, border=1)
        sizer.Add(
            StaticText(
                panel,
                label=_("Name of bottom/right raster map:")),
            proportion=0,
            flag=wx.EXPAND | wx.ALL,
            border=1)
        sizer.Add(self._secondRaster, proportion=0,
                  flag=wx.EXPAND | wx.ALL, border=1)

        self._firstRaster.SetFocus()

        panel.SetSizer(sizer)
        sizer.Fit(panel)

        return panel
Пример #3
0
    def __init__(
        self,
        parent,
        group=None,
        subgroup=None,
        title=_("Select imagery group"),
        id=wx.ID_ANY,
    ):
        """
        Does post init and layout.

        :param parent: gui parent
        :param title: dialog window title
        :param id: wx id
        """
        SimpleDialog.__init__(self, parent, title)

        self.use_subg = True

        self.groupSelect = gselect.Select(
            parent=self.panel,
            type="group",
            mapsets=[grass.gisenv()["MAPSET"]],
            size=globalvar.DIALOG_GSELECT_SIZE,
            validator=SimpleValidator(callback=self.ValidatorCallback),
        )

        # TODO use when subgroup will be optional
        # self.subg_chbox = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
        #                              label = _("Use subgroup"))
        self.subGroupSelect = gselect.SubGroupSelect(parent=self.panel)

        self.groupSelect.SetFocus()
        if group:
            self.groupSelect.SetValue(group)
            self.GroupSelected()
        if subgroup:
            self.subGroupSelect.SetValue(subgroup)

        self.editGroup = Button(
            parent=self.panel, id=wx.ID_ANY, label=_("Create/edit group...")
        )

        self.editGroup.Bind(wx.EVT_BUTTON, self.OnEditGroup)
        self.groupSelect.GetTextCtrl().Bind(
            wx.EVT_TEXT, lambda event: wx.CallAfter(self.GroupSelected)
        )

        self.warning = _("Name of imagery group is missing.")
        self._layout()
        self.SetMinSize(self.GetSize())
Пример #4
0
    def __init__(self, parent, title, element):
        """
        
        :param parent: gui parent
        :param title: dialog title
        :param element: element type ('raster', 'vector')
        """
        
        SimpleDialog.__init__(self, parent, title = title)
        
        self.elementType = element
        self.element = gselect.Select(parent = self.panel, type = element,
                                      size = globalvar.DIALOG_GSELECT_SIZE,
                                      validator = SimpleValidator(callback = self.ValidatorCallback))
        self.element.SetFocus()

        self.warning = _("Name of map is missing.")
        self._layout()
        self.SetMinSize(self.GetSize())