コード例 #1
0
    def __init__(self, parent, giface):
        ImportDialog.__init__(self,
                              parent,
                              giface=giface,
                              itype='dxf',
                              title=_("Import DXF layers"))

        self.list.SetValidator(
            LayersListValidator(condition='vector',
                                callback=self._nameValidationFailed))

        self._giface = giface
        self.dsnInput = filebrowse.FileBrowseButton(
            parent=self.panel,
            id=wx.ID_ANY,
            size=globalvar.DIALOG_GSELECT_SIZE,
            labelText='',
            dialogTitle=_('Choose DXF file to import'),
            buttonText=_('Browse'),
            startDirectory=os.getcwd(),
            fileMode=0,
            changeCallback=self.OnSetDsn,
            fileMask="DXF File (*.dxf)|*.dxf")

        self.add.SetLabel(_("Add imported layers into layer tree"))

        self.add.SetValue(
            UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled'))

        self.doLayout()
コード例 #2
0
ファイル: import_export.py プロジェクト: manish193/grass
    def __init__(self, parent, giface, link=False):
        """Dialog for bulk import of various vector data

        .. todo::
            split importing logic from gui code

        :param parent: parent window
        :param link: True for linking data otherwise importing data
        """
        self._giface = giface
        self.link = link

        self.layersData = []

        ImportDialog.__init__(self, parent, giface=giface, itype='ogr')

        self.list.SetValidator(
            LayersListValidator(
                condition='vector',
                callback=self._nameValidationFailed))

        if link:
            self.SetTitle(_("Link external vector data"))
        else:
            self.SetTitle(_("Import vector data"))

        self.dsnInput = GdalSelect(parent=self, panel=self.panel,
                                   ogr=True, link=link)
        self.dsnInput.AttachSettings()
        self.dsnInput.reloadDataRequired.connect(self.reload)

        if link:
            self.add.SetLabel(_("Add linked layers into layer tree"))
        else:
            self.add.SetLabel(_("Add imported layers into layer tree"))

        self.add.SetValue(
            UserSettings.Get(
                group='cmd',
                key='addNewLayer',
                subkey='enabled'))

        if link:
            self.btn_run.SetLabel(_("&Link"))
            self.btn_run.SetToolTip(_("Link selected layers"))
        else:
            self.btn_run.SetLabel(_("&Import"))
            self.btn_run.SetToolTip(_("Import selected layers"))

        self.doLayout()