Пример #1
0
 def OnRename(self, event):
     """Rename an existing configuration file"""
     try:
         confile = self.listfiles[self.listfileBox.GetSelections()[0]]
     except IndexError:
         gcmd.GMessage(
             parent=self, message=_("You have to select a configuration file")
         )
         return
     dlg = wx.TextEntryDialog(
         parent=self.parent,
         message=_(
             'Set the new name for %s " \
                                        "configuration file'
         )
         % confile,
         caption=_("Rename configuration file"),
     )
     if dlg.ShowModal() == wx.ID_OK:
         res = dlg.GetValue()
         newname = "%s%s%s" % (self.rlipath, os.sep, res)
         os.rename(os.path.join(self.rlipath, confile), newname)
         self.listfiles = self.ListFiles()
         self.listfileBox.Clear()
         self.listfileBox.Set(self.listfiles)
Пример #2
0
 def OnView(self, event):
     """Show and edit a configuration file"""
     try:
         confile = self.listfiles[self.listfileBox.GetSelections()[0]]
     except:
         gcmd.GMessage(parent=self,
                       message=_("You have to select a configuration file"))
         return
     frame = ViewFrame(self, conf=confile)
     frame.Show()
Пример #3
0
 def nextCircle(self, next=True, circle=None):
     self.mapWindow.ClearLines()
     item = self._registeredGraphics.GetItem(0)
     item.SetPropertyVal('hide', True)
     layers = self.map_.GetListOfLayers()
     self.mapWindow.ZoomToMap(layers=layers, ignoreNulls=False, render=True)
     if next is True:
         self.afterCircleDrawn.emit(region=circle)
     else:
         gcmd.GMessage(parent=self.parent, message=_(
             "Raster map not created. redraw region again."))
Пример #4
0
    def nextRegion(self, next=True, area=None):
        self.mapWindow.ClearLines()
        item = self._registeredGraphics.GetItem(0)
        item.SetCoords([])
        item.SetPropertyVal('hide', True)

        layers = self.map_.GetListOfLayers()
        self.mapWindow.ZoomToMap(layers=layers, ignoreNulls=False, render=True)
        if next is True:
            self.afterRegionDrawn.emit(marea=area)
        else:
            gcmd.GMessage(parent=self.parent, message=_(
                "Raster map not created. Please redraw region."))
Пример #5
0
    def OnRemove(self, event):
        """Remove configuration file from path and update the list"""
        try:
            confile = self.listfiles[self.listfileBox.GetSelections()[0]]
        except IndexError:
            gcmd.GMessage(parent=self,
                          message=_("You have to select a configuration file"))
            return
        dlg = wx.MessageDialog(
            parent=self.parent,
            message=_("Do you want remove r.li "
                      "configuration file <%s>?") % confile,
            caption=_("Remove new r.li configuration file?"),
            style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)

        if dlg.ShowModal() == wx.ID_YES:
            self.listfileBox.Delete(self.listfileBox.GetSelections()[0])
            try_remove(os.path.join(self.rlipath, confile))
            self.listfiles = self.ListFiles()
        dlg.Destroy()
        return