Exemplo n.º 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())
Exemplo n.º 2
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())
Exemplo n.º 3
0
    def __init__(self, parent, old_name, title=("Change class name")):
        SimpleDialog.__init__(self, parent, title)

        self.name = wx.TextCtrl(self.panel, id=wx.ID_ANY)
        self.name.SetValue(old_name)

        self.dataSizer.Add(self.name, proportion=0, flag=wx.EXPAND | wx.ALL, border=1)

        self.panel.SetSizer(self.sizer)
        self.name.SetMinSize((200, -1))
        self.sizer.Fit(self)
Exemplo n.º 4
0
    def __init__(self, parent, old_name, title=("Change class name")):
        SimpleDialog.__init__(self, parent, title)

        self.name = TextCtrl(self.panel, id=wx.ID_ANY)
        self.name.SetValue(old_name)

        self.dataSizer.Add(self.name, proportion=0,
                           flag=wx.EXPAND | wx.ALL, border=1)

        self.panel.SetSizer(self.sizer)
        self.name.SetMinSize((200, -1))
        self.sizer.Fit(self)
Exemplo n.º 5
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())
Exemplo n.º 6
0
    def __init__(self, parent, title=_("Choose raster map")):
        """!Calls super class constructor.

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

        # here is the place to determine element type
        self.element = gselect.Select(parent=self.panel, type="raster", size=globalvar.DIALOG_GSELECT_SIZE)

        self._layout()

        self.SetMinSize(self.GetSize())
Exemplo n.º 7
0
    def __init__(self, parent, title=_("Choose raster map")):
        """!Calls super class constructor.

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

        # here is the place to determine element type
        self.element = gselect.Select(parent=self.panel,
                                      type="raster",
                                      size=globalvar.DIALOG_GSELECT_SIZE)

        self._layout()

        self.SetMinSize(self.GetSize())
Exemplo n.º 8
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 = wx.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())
Exemplo n.º 9
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())