Ejemplo n.º 1
0
 def _layoutShape(self, shape, sizer):
     if isinstance(shape, ModelData):
         sizer.Add(StaticText(parent=self.panel,
                              id=wx.ID_ANY,
                              label=_("Data: %s") % shape.GetLog()),
                   proportion=1,
                   flag=wx.EXPAND | wx.ALL,
                   border=5)
     elif isinstance(shape, ModelAction):
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer.Add(StaticText(parent=self.panel,
                                  id=wx.ID_ANY,
                                  label=_("Command:")),
                       pos=(0, 0))
         gridSizer.Add(StaticText(parent=self.panel,
                                  id=wx.ID_ANY,
                                  label=shape.GetLabel()),
                       pos=(0, 1))
         gridSizer.Add(StaticText(parent=self.panel,
                                  id=wx.ID_ANY,
                                  label=_("Option:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
         gridSizer.Add(self.option, pos=(1, 1))
         sizer.Add(gridSizer,
                   proportion=1,
                   flag=wx.EXPAND | wx.ALL,
                   border=5)
Ejemplo n.º 2
0
    def _layout(self):
        """Do layout"""
        if self.etype:
            self.dataSizer.Add(StaticText(parent=self.panel,
                                          id=wx.ID_ANY,
                                          label=_("Type of element:")),
                               proportion=0,
                               flag=wx.ALL,
                               border=1)
            self.dataSizer.Add(self.typeSelect,
                               proportion=0,
                               flag=wx.ALL,
                               border=1)
        self.dataSizer.Add(StaticText(parent=self.panel,
                                      id=wx.ID_ANY,
                                      label=_("Name of element:")),
                           proportion=0,
                           flag=wx.ALL,
                           border=1)
        self.dataSizer.Add(self.element,
                           proportion=0,
                           flag=wx.EXPAND | wx.ALL,
                           border=1)

        self.panel.SetSizer(self.sizer)
        self.sizer.Fit(self)
Ejemplo n.º 3
0
    def MakeAdvConnPane(self, pane):
        """Create advanced connection settings pane"""
        self.usernameText = StaticText(parent=pane, id=wx.ID_ANY, label=_("Username:"******"Password:"))
        self.password = TextCtrl(parent=pane, id=wx.ID_ANY, style=wx.TE_PASSWORD)

        # pane layout
        adv_conn_sizer = wx.BoxSizer(wx.VERTICAL)

        usernameSizer = wx.BoxSizer(wx.HORIZONTAL)

        usernameSizer.Add(self.usernameText, flag=wx.ALIGN_CENTER_VERTICAL, border=5)

        usernameSizer.Add(self.username, proportion=1, flag=wx.EXPAND, border=5)

        adv_conn_sizer.Add(usernameSizer, flag=wx.ALL | wx.EXPAND, border=5)

        passwSizer = wx.BoxSizer(wx.HORIZONTAL)

        passwSizer.Add(self.passwText, flag=wx.ALIGN_CENTER_VERTICAL, border=5)

        passwSizer.Add(self.password, proportion=1, flag=wx.EXPAND, border=5)

        adv_conn_sizer.Add(passwSizer, flag=wx.ALL | wx.EXPAND, border=5)

        pane.SetSizer(adv_conn_sizer)
        adv_conn_sizer.Fit(pane)

        pane.SetSizer(adv_conn_sizer)
        adv_conn_sizer.Fit(pane)
Ejemplo n.º 4
0
    def _layout(self):
        """Do layout"""
        self.dataSizer.Add(StaticText(self.panel,
                                      id=wx.ID_ANY,
                                      label=_("Name of imagery group:")),
                           proportion=0,
                           flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                           border=5)
        self.dataSizer.Add(self.groupSelect,
                           proportion=0,
                           flag=wx.EXPAND | wx.ALL,
                           border=5)

        # TODO use when subgroup will be optional
        # self.dataSizer.Add(self.subg_chbox, proportion = 0,
        # flag = wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border = 5)

        self.dataSizer.Add(StaticText(self.panel,
                                      id=wx.ID_ANY,
                                      label=_("Name of imagery subgroup:")),
                           proportion=0,
                           flag=wx.EXPAND | wx.EXPAND | wx.BOTTOM | wx.LEFT
                           | wx.RIGHT,
                           border=5)
        self.dataSizer.Add(self.subGroupSelect,
                           proportion=0,
                           flag=wx.EXPAND | wx.ALL,
                           border=5)

        self.dataSizer.Add(self.editGroup, proportion=0, flag=wx.ALL, border=5)

        self.panel.SetSizer(self.sizer)
        self.sizer.Fit(self)
Ejemplo n.º 5
0
    def _createWidgets(self):

        self.labels = {}
        self.params = {}

        self.band_1_label = StaticText(
            parent=self, id=wx.ID_ANY, label=_("x axis:"))

        self.band_1_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
                                     choices=self.bands,
                                     style=wx.CB_READONLY, size=(350, 30))

        self.band_2_label = StaticText(
            parent=self, id=wx.ID_ANY, label=_("y axis:"))

        self.band_2_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
                                     choices=self.bands,
                                     style=wx.CB_READONLY, size=(350, 30))

        self.scattsBox = wx.ListBox(parent=self, id=wx.ID_ANY, size=(-1, 150),
                                    style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)

        # buttons
        self.btn_add = Button(parent=self, id=wx.ID_ADD)
        self.btn_remove = Button(parent=self, id=wx.ID_REMOVE)

        self.btn_close = Button(parent=self, id=wx.ID_CANCEL)
        self.btn_ok = Button(parent=self, id=wx.ID_OK)

        self._layout()
Ejemplo n.º 6
0
    def __layout(self):
        """Do layout"""
        sizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer.Add(
            StaticText(
                parent=self.panel,
                id=wx.ID_ANY,
                label=_("Enter name of signature file:"),
            ),
            proportion=0,
            flag=wx.ALL,
            border=3,
        )
        self.fileNameCtrl = TextCtrl(parent=self.panel, id=wx.ID_ANY, size=(400, -1))
        if self.fileName:
            self.fileNameCtrl.SetValue(self.fileName)
        dataSizer.Add(
            self.fileNameCtrl, proportion=0, flag=wx.ALL | wx.EXPAND, border=3
        )

        dataSizer.Add(
            StaticText(
                parent=self.panel, id=wx.ID_ANY, label=_("Signature file path:")
            ),
            proportion=0,
            flag=wx.ALL,
            border=3,
        )

        self.pathPanel = scrolled.ScrolledPanel(self.panel, size=(-1, 40))
        pathSizer = wx.BoxSizer()
        self.filePathText = StaticText(
            parent=self.pathPanel, id=wx.ID_ANY, label=self.baseFilePath
        )
        pathSizer.Add(
            self.filePathText, proportion=1, flag=wx.ALL | wx.EXPAND, border=1
        )
        self.pathPanel.SetupScrolling(scroll_x=True, scroll_y=False)
        self.pathPanel.SetSizer(pathSizer)

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

        # buttons
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.btnCancel)
        btnSizer.AddButton(self.btnOK)
        btnSizer.Realize()

        sizer.Add(dataSizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)

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

        self.SetMinSize(self.GetSize())
Ejemplo n.º 7
0
    def _doLayout(self):
        """Do layout"""
        dialogSizer = wx.BoxSizer(wx.VERTICAL)
        optionsSizer = wx.GridBagSizer(5, 5)

        label = _("Map layer <{ml}> needs to be reprojected.\n"
                  "Please review and modify reprojection parameters:").format(
                      ml=self.iLayer)
        dialogSizer.Add(StaticText(self.panel, label=label),
                        flag=wx.ALL | wx.EXPAND,
                        border=10)
        if self.etype == 'raster':
            optionsSizer.Add(StaticText(self.panel,
                                        label=_("Estimated resolution:")),
                             pos=(0, 0),
                             flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
            optionsSizer.Add(self.resolution, pos=(0, 1), flag=wx.EXPAND)
            optionsSizer.Add(StaticText(self.panel,
                                        label=_("Resampling method:")),
                             pos=(1, 0),
                             flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
            optionsSizer.Add(self.resampling, pos=(1, 1), flag=wx.EXPAND)
        else:
            optionsSizer.Add(StaticText(self.panel,
                                        label=_("Maximum segment length:")),
                             pos=(1, 0),
                             flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
            optionsSizer.Add(self.vsplit, pos=(1, 1), flag=wx.EXPAND)
        optionsSizer.AddGrowableCol(1)
        dialogSizer.Add(optionsSizer,
                        proportion=1,
                        flag=wx.ALL | wx.EXPAND,
                        border=10)
        helptext = StaticText(
            self.panel,
            label="For more reprojection options,"
            " please see {module}".format(
                module='r.proj' if self.etype == 'raster' else 'v.proj'))
        dialogSizer.Add(helptext,
                        proportion=0,
                        flag=wx.ALL | wx.EXPAND,
                        border=10)
        #
        # buttons
        #
        btnStdSizer = wx.StdDialogButtonSizer()
        btnStdSizer.AddButton(self.btn_run)
        btnStdSizer.AddButton(self.btn_close)
        btnStdSizer.Realize()
        dialogSizer.Add(btnStdSizer,
                        proportion=0,
                        flag=wx.ALL | wx.EXPAND,
                        border=5)

        self.panel.SetSizer(dialogSizer)
        dialogSizer.Fit(self.panel)

        self.Layout()
        self.SetSize(self.GetBestSize())
Ejemplo n.º 8
0
    def _layout(self):

        sizer = wx.BoxSizer(wx.VERTICAL)
        addSizer = wx.BoxSizer(wx.HORIZONTAL)

        addSizer.Add(
            StaticText(parent=self, id=wx.ID_ANY, label=_("Column")),
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )
        addSizer.Add(
            self.data["addColName"],
            proportion=1,
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )

        addSizer.Add(
            StaticText(parent=self, id=wx.ID_ANY, label=_("Type")),
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )
        addSizer.Add(
            self.data["addColType"],
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )

        addSizer.Add(
            StaticText(parent=self, id=wx.ID_ANY, label=_("Length")),
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )
        addSizer.Add(
            self.data["addColLength"],
            flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
            border=5,
        )

        sizer.Add(addSizer,
                  proportion=0,
                  flag=wx.ALIGN_RIGHT | wx.ALL,
                  border=5)

        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.btnCancel)
        btnSizer.AddButton(self.btnOk)
        btnSizer.Realize()

        sizer.Add(btnSizer,
                  proportion=0,
                  flag=wx.ALIGN_RIGHT | wx.ALL,
                  border=5)

        self.SetSizer(sizer)

        self.Fit()
Ejemplo n.º 9
0
    def _layout(self):
        metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
                                 label=_("Name:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(0, 0))
        gridSizer.Add(self.name,
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                      pos=(0, 1))
        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
                                 label=_("Description:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(1, 0))
        gridSizer.Add(self.desc,
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                      pos=(1, 1))
        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
                                 label=_("Author(s):")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(2, 0))
        gridSizer.Add(self.author,
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                      pos=(2, 1))
        gridSizer.AddGrowableCol(1)
        gridSizer.AddGrowableRow(1)
        metaSizer.Add(gridSizer, proportion=1, flag=wx.EXPAND)

        cmdSizer = wx.StaticBoxSizer(self.cmdBox, wx.VERTICAL)
        cmdSizer.Add(self.overwrite,
                     flag=wx.EXPAND | wx.ALL, border=3)

        btnStdSizer = wx.StdDialogButtonSizer()
        btnStdSizer.AddButton(self.btnCancel)
        btnStdSizer.AddButton(self.btnOk)
        btnStdSizer.Realize()

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(metaSizer, proportion=1,
                      flag=wx.EXPAND | wx.ALL, border=5)
        mainSizer.Add(
            cmdSizer,
            proportion=0,
            flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
            border=5)
        mainSizer.Add(btnStdSizer, proportion=0,
                      flag=wx.EXPAND | wx.ALL, border=5)

        self.SetSizer(mainSizer)
        mainSizer.Fit(self)
Ejemplo n.º 10
0
    def _createFlyPage(self, notebook):
        """Create notebook page for view settings"""
        panel = wx.Panel(parent=notebook, id=wx.ID_ANY)

        notebook.AddPage(page=panel, text=" %s " % _("Fly-through"))
        pageSizer = wx.BoxSizer(wx.VERTICAL)
        # fly throuhg mode
        box = StaticBox(
            parent=panel, id=wx.ID_ANY, label=" %s " % (_("Fly-through mode"))
        )
        boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        gridSizer = wx.GridBagSizer(vgap=3, hgap=3)

        # move exag
        gridSizer.Add(
            StaticText(parent=panel, id=wx.ID_ANY, label=_("Move exag:")),
            pos=(0, 0),
            flag=wx.ALIGN_CENTER_VERTICAL,
        )

        moveExag = SpinCtrl(
            panel,
            id=wx.ID_ANY,
            min=1,
            max=20,
            initial=UserSettings.Get(group="nviz", key="fly", subkey=["exag", "move"]),
            size=(65, -1),
        )
        self.winId["nviz:fly:exag:move"] = moveExag.GetId()
        gridSizer.Add(moveExag, pos=(0, 1))

        # turn exag
        gridSizer.Add(
            StaticText(parent=panel, id=wx.ID_ANY, label=_("Turn exag:")),
            pos=(1, 0),
            flag=wx.ALIGN_CENTER_VERTICAL,
        )

        turnExag = SpinCtrl(
            panel,
            id=wx.ID_ANY,
            min=1,
            max=20,
            initial=UserSettings.Get(group="nviz", key="fly", subkey=["exag", "turn"]),
            size=(65, -1),
        )
        self.winId["nviz:fly:exag:turn"] = turnExag.GetId()
        gridSizer.Add(turnExag, pos=(1, 1))

        gridSizer.AddGrowableCol(0)
        boxSizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        pageSizer.Add(boxSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5)

        panel.SetSizer(pageSizer)

        return panel
Ejemplo n.º 11
0
    def __init__(self, parent):
        AnimationSliderBase.__init__(self, parent)
        self.timeLabels = []
        self.label2 = StaticText(self, id=wx.ID_ANY)
        self.label3 = StaticText(self, id=wx.ID_ANY)
        self.label2Length = 0
        self.temporalType = TemporalType.RELATIVE

        self._setLabel()
        self._doLayout()
Ejemplo n.º 12
0
    def _layout(self):
        cmdSizer = wx.StaticBoxSizer(self.cmdBox, wx.VERTICAL)
        cmdSizer.Add(self.cmd_prompt, proportion=1, flag=wx.EXPAND)
        labelSizer = wx.StaticBoxSizer(self.labelBox, wx.VERTICAL)
        gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
        gridSizer.Add(
            StaticText(parent=self.panel, id=wx.ID_ANY, label=_("Label:")),
            flag=wx.ALIGN_CENTER_VERTICAL,
            pos=(0, 0),
        )
        gridSizer.Add(self.label, pos=(0, 1), flag=wx.EXPAND)
        gridSizer.Add(
            StaticText(parent=self.panel, id=wx.ID_ANY, label=_("Comment:")),
            flag=wx.ALIGN_CENTER_VERTICAL,
            pos=(1, 0),
        )
        gridSizer.Add(self.comment, pos=(1, 1), flag=wx.EXPAND)
        gridSizer.AddGrowableRow(1)
        gridSizer.AddGrowableCol(1)
        labelSizer.Add(gridSizer, proportion=1, flag=wx.EXPAND)

        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.btnCancel)
        btnSizer.AddButton(self.btnOk)
        btnSizer.Realize()

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.search,
                      proportion=0,
                      flag=wx.EXPAND | wx.ALL,
                      border=3)
        mainSizer.Add(
            cmdSizer,
            proportion=1,
            flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
            border=3,
        )
        mainSizer.Add(
            labelSizer,
            proportion=1,
            flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
            border=3,
        )
        mainSizer.Add(btnSizer,
                      proportion=0,
                      flag=wx.EXPAND | wx.ALL,
                      border=5)

        self.panel.SetSizer(mainSizer)
        mainSizer.Fit(self)

        self.Layout()
Ejemplo n.º 13
0
    def __init__(self, parent, database, locations=LOCATIONS):
        """

        :param database: directory with G database to download to
        :param locations: list of dictionaries with label and url
        """
        wx.Panel.__init__(self, parent=parent)

        self._last_downloaded_location_name = None
        self._download_in_progress = False
        self.database = database
        self.locations = locations

        self.label = StaticText(
            parent=self,
            label=_("Select sample location to download:"))

        choices = []
        for item in self.locations:
            choices.append(item['label'])
        self.choice = wx.Choice(parent=self, choices=choices)

        self.choice.Bind(wx.EVT_CHOICE, self.OnChangeChoice)

        self.download_button = Button(parent=self, id=wx.ID_ANY,
                                      label=_("Do&wnload"))
        self.download_button.SetToolTip(_("Download selected location"))
        self.download_button.Bind(wx.EVT_BUTTON, self.OnDownload)
        # TODO: add button for a link to an associated website?
        # TODO: add thumbnail for each location?

        # TODO: messages copied from gis_set.py, need this as API?
        self.message = StaticText(parent=self, size=(-1, 50))
        sys.stdout = RedirectText(self.message)

        # It is not clear if all wx versions supports color, so try-except.
        # The color itself may not be correct for all platforms/system settings
        # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
        # there is no 'warning' color.
        try:
            self.message.SetForegroundColour(wx.Colour(255, 0, 0))
        except AttributeError:
            pass

        self._layout()

        default = 0
        self.choice.SetSelection(default)
        self.CheckItem(self.locations[default])

        self.thread = gThread()
Ejemplo n.º 14
0
def CreateDbInfoDesc(panel, mapDBInfo, layer):
    """Create database connection information content"""
    infoFlexSizer = wx.FlexGridSizer(cols=2, hgap=1, vgap=1)
    infoFlexSizer.AddGrowableCol(1)

    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label="Driver:"))
    infoFlexSizer.Add(
        StaticText(parent=panel,
                   id=wx.ID_ANY,
                   label=mapDBInfo.layers[layer]['driver']))
    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label="Database:"))
    infoFlexSizer.Add(
        StaticText(parent=panel,
                   id=wx.ID_ANY,
                   label=mapDBInfo.layers[layer]['database']))
    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label="Table:"))
    infoFlexSizer.Add(
        StaticText(parent=panel,
                   id=wx.ID_ANY,
                   label=mapDBInfo.layers[layer]['table']))
    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label="Key:"))
    infoFlexSizer.Add(
        StaticText(parent=panel,
                   id=wx.ID_ANY,
                   label=mapDBInfo.layers[layer]['key']))

    return infoFlexSizer
Ejemplo n.º 15
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent)
        self.SetTitle(_("Create new raster map"))
        self._name = None
        self._type = None

        # create widgets
        self._mapSelect = Select(parent=self, type='raster')
        self._backgroundSelect = Select(parent=self, type='raster')
        self._typeChoice = wx.Choice(self, choices=['CELL', 'FCELL', 'DCELL'])
        self._typeChoice.SetSelection(0)
        self._mapSelect.SetFocus()

        btnCancel = Button(parent=self, id=wx.ID_CANCEL)
        btnOK = Button(parent=self, id=wx.ID_OK)
        btnOK.SetDefault()
        btnOK.Bind(wx.EVT_BUTTON, self.OnOK)

        # do layout
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        sizer = wx.GridBagSizer(hgap=10, vgap=10)
        sizer.Add(StaticText(self, label=_("Name for new raster map:")),
                  pos=(0, 0),
                  span=(1, 2),
                  flag=wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self._mapSelect, pos=(1, 0), span=(1, 2))
        sizer.Add(StaticText(
            self, label=_("Optionally select background raster map:")),
                  pos=(2, 0),
                  span=(1, 2),
                  flag=wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self._backgroundSelect, pos=(3, 0), span=(1, 2))
        sizer.Add(StaticText(self, label=_("New raster map type:")),
                  pos=(4, 0),
                  flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self._typeChoice, pos=(4, 1), flag=wx.EXPAND)

        mainSizer.Add(sizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)

        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(btnCancel)
        btnSizer.AddButton(btnOK)
        btnSizer.Realize()

        mainSizer.Add(btnSizer, flag=wx.EXPAND | wx.ALL, border=10)

        self._backgroundSelect.Bind(wx.EVT_TEXT, self.OnBackgroundMap)

        self.SetSizer(mainSizer)
        mainSizer.Fit(self)
Ejemplo n.º 16
0
    def __init__(self, parent, stats_data):
        """IClass toolbar constructor
        """
        self.stats_data = stats_data

        BaseToolbar.__init__(self, parent)
        self.InitToolbar(self._toolbarData())

        self.choice = wx.Choice(parent=self, id=wx.ID_ANY, size=(110, -1))
        choiceid = self.InsertControl(3, self.choice)

        self.choice.Bind(wx.EVT_CHOICE, self.OnSelectCategory)

        # stupid workaround to insert small space between controls
        self.InsertControl(4, StaticText(self, id=wx.ID_ANY, label=' '))

        self.combo = wx.ComboBox(self,
                                 id=wx.ID_ANY,
                                 size=(130, -1),
                                 style=wx.TE_PROCESS_ENTER)
        self.InitStddev()
        comboid = self.InsertControl(5, self.combo)

        self.EnableControls(False)

        self.combo.Bind(wx.EVT_COMBOBOX, self.OnStdChangeSelection)
        self.combo.Bind(wx.EVT_TEXT_ENTER, self.OnStdChangeText)

        self.stats_data.statisticsAdded.connect(self.Update)
        self.stats_data.statisticsDeleted.connect(self.Update)
        self.stats_data.allStatisticsDeleted.connect(self.Update)
        self.stats_data.statisticsSet.connect(self.Update)

        # realize the toolbar
        self.Realize()
Ejemplo n.º 17
0
    def __init__(self, mapframe, statusbar, position=0):
        SbItem.__init__(self, mapframe, statusbar, position)
        self.name = "mask"

        self.widget = StaticText(parent=self.statusbar, id=wx.ID_ANY, label=_("MASK"))
        self.widget.SetForegroundColour(wx.Colour(255, 0, 0))
        self.widget.Hide()
Ejemplo n.º 18
0
    def _pageStats(self):
        """Translation statistics info"""
        fname = "translation_status.json"
        statsfile = os.path.join(os.getenv("GISBASE"), fname)
        if os.path.exists(statsfile):
            statsFile = open(statsfile)
            import json
            jsStats = json.load(statsFile)
        else:
            jsStats = None
        self.statswin = ScrolledPanel(self.aboutNotebook)
        self.statswin.SetBackgroundColour('WHITE')
        self.statswin.SetAutoLayout(True)

        if not jsStats:
            Debug.msg(5, _("File <%s> not found") % fname)
            statsSizer = wx.BoxSizer(wx.VERTICAL)
            statstext = StaticText(self.statswin, id=wx.ID_ANY,
                                   label=_('%s file missing') % fname)
            statsSizer.Add(statstext, proportion=1,
                           flag=wx.EXPAND | wx.ALL, border=3)
        else:
            languages = sorted(jsStats['langs'].keys())

            statsSizer = wx.BoxSizer(wx.VERTICAL)
            for lang in languages:
                v = jsStats['langs'][lang]
                panel = self._langPanel(lang, v)
                statsSizer.Add(panel)

        self.statswin.SetSizer(statsSizer)
        self.statswin.SetupScrolling(scroll_x=False, scroll_y=True)
        self.statswin.Layout()
        self.statswin.Fit()
        return self.statswin
Ejemplo n.º 19
0
 def _langBox(self, par, k, v):
     """Return box"""
     langBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
     tkey = StaticText(parent=par, id=wx.ID_ANY, label=k.upper())
     langBox.Add(tkey)
     try:
         tgood = StaticText(parent=par,
                            id=wx.ID_ANY,
                            label=_("%d translated" % v['good']))
         tgood.SetForegroundColour(wx.Colour(35, 142, 35))
         langBox.Add(tgood)
     except:
         tgood = StaticText(parent=par, id=wx.ID_ANY, label="")
         langBox.Add(tgood)
     try:
         tfuzzy = StaticText(parent=par,
                             id=wx.ID_ANY,
                             label=_("   %d fuzzy" % v['fuzzy']))
         tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0))
         langBox.Add(tfuzzy)
     except:
         tfuzzy = StaticText(parent=par, id=wx.ID_ANY, label="")
         langBox.Add(tfuzzy)
     try:
         tbad = StaticText(parent=par,
                           id=wx.ID_ANY,
                           label=_("   %d untranslated" % v['bad']))
         tbad.SetForegroundColour(wx.Colour(255, 0, 0))
         langBox.Add(tbad)
     except:
         tbad = StaticText(parent=par, id=wx.ID_ANY, label="")
         langBox.Add(tbad)
     return langBox
Ejemplo n.º 20
0
    def __init__(self, parent, handlerObj, giface, model, id=wx.ID_ANY,
                 **kwargs):
        self.parent = parent
        self._handlerObj = handlerObj
        self._giface = giface

        self.showNotification = Signal('SearchModuleWindow.showNotification')
        wx.Panel.__init__(self, parent=parent, id=id, **kwargs)

        # tree
        self._tree = CTreeView(model=model, parent=self)
        self._tree.SetToolTip(
            _("Double-click or Ctrl-Enter to run selected module"))

#        self._dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
#                                     label = " %s " % _("Module tree"))

        # search widget
        self._search = SearchModuleWidget(parent=self,
                                          model=model,
                                          showChoice=False)
        self._search.showSearchResult.connect(
            lambda result: self._tree.Select(result))
        self._search.showNotification.connect(self.showNotification)

        self._helpText = StaticText(
            parent=self, id=wx.ID_ANY,
            label="Press Enter for next match, Ctrl+Enter to run command")
        self._helpText.SetForegroundColour(
            wx.SystemSettings.GetColour(
                wx.SYS_COLOUR_GRAYTEXT))

        # buttons
        self._btnRun = Button(self, id=wx.ID_OK, label=_("&Run"))
        self._btnRun.SetToolTip(_("Run selected module from the tree"))
        self._btnHelp = Button(self, id=wx.ID_ANY, label=_("H&elp"))
        self._btnHelp.SetToolTip(
            _("Show manual for selected module from the tree"))
        self._btnAdvancedSearch = Button(self, id=wx.ID_ANY,
                                         label=_("Adva&nced search..."))
        self._btnAdvancedSearch.SetToolTip(
            _("Do advanced search using %s module") % 'g.search.module')

        # bindings
        self._btnRun.Bind(wx.EVT_BUTTON, lambda evt: self.Run())
        self._btnHelp.Bind(wx.EVT_BUTTON, lambda evt: self.Help())
        self._btnAdvancedSearch.Bind(wx.EVT_BUTTON,
                                     lambda evt: self.AdvancedSearch())
        self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)

        self._tree.selectionChanged.connect(self.OnItemSelected)
        self._tree.itemActivated.connect(lambda node: self.Run(node))

        self._layout()

        self._search.SetFocus()
Ejemplo n.º 21
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
Ejemplo n.º 22
0
 def __init__(self, parent, title):
     self._cf = wx.Frame(parent=parent, title=title)
     self._cp = wx.Panel(parent=self._cf, id=wx.ID_ANY)
     self._cs = wx.BoxSizer(wx.VERTICAL)
     self._cl = StaticText(parent=self._cp,
                           id=wx.ID_ANY,
                           label="No text set yet")
     self._cs.Add(self._cl, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)
     self._cp.SetSizer(self._cs)
     self._cp.Layout()
     self._cf.Show()
Ejemplo n.º 23
0
    def __layout(self):
        """Do layout"""
        sizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer.Add(StaticText(parent=self.panel,
                                 id=wx.ID_ANY,
                                 label=_("Enter name of new vector map:")),
                      proportion=0,
                      flag=wx.ALL,
                      border=3)
        self.vectorNameCtrl = gselect.Select(
            parent=self.panel,
            type='vector',
            mapsets=[grass.gisenv()['MAPSET']],
            size=globalvar.DIALOG_GSELECT_SIZE)
        if self.vectorName:
            self.vectorNameCtrl.SetValue(self.vectorName)
        dataSizer.Add(self.vectorNameCtrl,
                      proportion=0,
                      flag=wx.ALL | wx.EXPAND,
                      border=3)
        self.withTableCtrl = CheckBox(parent=self.panel,
                                      id=wx.ID_ANY,
                                      label=_("Export attribute table"))
        self.withTableCtrl.SetValue(True)
        self.withTableCtrl.SetToolTip(
            _("Export attribute table containing"
              " computed statistical data"))

        dataSizer.Add(self.withTableCtrl, proportion=0, flag=wx.ALL, border=3)

        # buttons
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.btnCancel)
        btnSizer.AddButton(self.btnOK)
        btnSizer.Realize()

        sizer.Add(dataSizer,
                  proportion=1,
                  flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER,
                  border=5)

        sizer.Add(btnSizer,
                  proportion=0,
                  flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER,
                  border=5)

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

        self.SetMinSize(self.GetSize())
Ejemplo n.º 24
0
    def __init__(self, parent, giface, data,
                 id=wx.ID_ANY, title=_("Reprojection"),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        self.parent = parent    # GMFrame
        self._giface = giface  # used to add layers

        wx.Dialog.__init__(self, parent, id, title, style=style,
                           name="MultiImportDialog")

        self.panel = wx.Panel(parent=self, id=wx.ID_ANY)

        # list of layers
        columns = [_('Layer id'),
                   _('Name for output GRASS map')]

        self.layerBox = StaticBox(parent=self.panel, id=wx.ID_ANY)
        self.layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL)

        self.list = GListCtrl(parent=self.panel)

        for i in range(len(columns)):
            self.list.InsertColumn(i, columns[i])

        width = (65, 180)

        for i in range(len(width)):
            self.list.SetColumnWidth(col=i, width=width[i])

        self.list.LoadData(data)
        self.list.SelectAll(True)

        self.labelText = StaticText(parent=self.panel, id=wx.ID_ANY, label=_(
            "Projection of following layers do not match with projection of current location. "))

        label = _("Layers to be reprojected")
        self.layerBox.SetLabel(" %s - %s " %
                               (label, _("right click to (un)select all")))

        #
        # buttons
        #
        # cancel
        self.btn_close = Button(parent=self.panel, id=wx.ID_CANCEL)

        # run
        self.btn_run = Button(
            parent=self.panel,
            id=wx.ID_OK,
            label=_("&Import && reproject"))
        self.btn_run.SetToolTip(_("Reproject selected layers"))
        self.btn_run.SetDefault()

        self.doLayout()
Ejemplo n.º 25
0
    def _createSymbologyPage(self, notebook):
        """Create notebook page concerning symbology settings"""
        panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
        notebook.AddPage(page=panel, text=_("Symbology"))

        sizer = wx.BoxSizer(wx.VERTICAL)

        flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
        flexSizer.AddGrowableCol(0)

        self.symbology = {}
        for label, key in self._symbologyData():
            textLabel = StaticText(panel, wx.ID_ANY, label)
            color = csel.ColourSelect(
                panel, id=wx.ID_ANY, colour=UserSettings.Get(
                    group='vdigit', key='symbol', subkey=[
                        key, 'color']), size=(
                    40, 25))
            isEnabled = UserSettings.Get(group='vdigit', key='symbol',
                                         subkey=[key, 'enabled'])
            if isEnabled is not None:
                enabled = wx.CheckBox(panel, id=wx.ID_ANY, label="")
                enabled.SetValue(isEnabled)
                self.symbology[key] = (enabled, color)
            else:
                enabled = (1, 1)
                self.symbology[key] = (None, color)

            flexSizer.Add(
                textLabel,
                proportion=0,
                flag=wx.ALIGN_CENTER_VERTICAL)
            flexSizer.Add(
                enabled,
                proportion=0,
                flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE)
            flexSizer.Add(
                color,
                proportion=0,
                flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
            color.SetName("GetColour")

        sizer.Add(
            flexSizer,
            proportion=1,
            flag=wx.ALL | wx.EXPAND,
            border=10)

        panel.SetSizer(sizer)

        return panel
Ejemplo n.º 26
0
    def _layout(self):
        """Do layout"""
        if self.elementType == 'raster':
            label = _("Name of raster map:")
        elif self.elementType == 'vector':
            label = _("Name of vector map:")
        self.dataSizer.Add(StaticText(self.panel, id=wx.ID_ANY,
                                      label=label),
                           proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
        self.dataSizer.Add(self.element, proportion=0,
                           flag=wx.EXPAND | wx.ALL, border=5)

        self.panel.SetSizer(self.sizer)
        self.sizer.Fit(self)
Ejemplo n.º 27
0
    def __layout(self):
        """Do layout"""
        sizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer = wx.BoxSizer(wx.VERTICAL)

        dataSizer.Add(
            StaticText(
                parent=self.panel,
                id=wx.ID_ANY,
                label=_("Enter name of new vector map:"),
            ),
            proportion=0,
            flag=wx.ALL,
            border=3,
        )
        self.vectorNameCtrl = Select(
            parent=self.panel,
            type="raster",
            mapsets=[grass.gisenv()["MAPSET"]],
            size=globalvar.DIALOG_GSELECT_SIZE,
        )
        if self.rasterName:
            self.vectorNameCtrl.SetValue(self.rasterName)
        dataSizer.Add(self.vectorNameCtrl,
                      proportion=0,
                      flag=wx.ALL | wx.EXPAND,
                      border=3)

        # buttons
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.btnCancel)
        btnSizer.AddButton(self.btnOK)
        btnSizer.Realize()

        sizer.Add(dataSizer,
                  proportion=1,
                  flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER,
                  border=5)

        sizer.Add(btnSizer,
                  proportion=0,
                  flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER,
                  border=5)

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

        self.SetMinSize(self.GetSize())
Ejemplo n.º 28
0
 def MakeLabel(self,
               text="",
               style=wx.ALIGN_LEFT,
               parent=None,
               tooltip=None):
     """Make aligned label"""
     if not parent:
         parent = self
     label = StaticText(parent=parent,
                        id=wx.ID_ANY,
                        label=text,
                        style=style)
     if tooltip:
         label.SetToolTip(tooltip)
     return label
Ejemplo n.º 29
0
    def _createGeneralPage(self, notebook):
        """Create notebook page for action settings"""
        panel = wx.Panel(parent=notebook, id=wx.ID_ANY)
        notebook.AddPage(page=panel, text=_("General"))

        # colors
        border = wx.BoxSizer(wx.VERTICAL)
        box = StaticBox(parent=panel, id=wx.ID_ANY,
                        label=" %s " % _("Item properties"))
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        gridSizer = wx.GridBagSizer(hgap=3, vgap=3)

        row = 0
        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Disabled:")),
                      flag=wx.ALIGN_LEFT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 0))
        rColor = csel.ColourSelect(
            parent=panel,
            id=wx.ID_ANY,
            colour=self.settings.Get(
                group='modeler',
                key='disabled',
                subkey='color'),
            size=globalvar.DIALOG_COLOR_SIZE)
        rColor.SetName('GetColour')
        self.winId['modeler:disabled:color'] = rColor.GetId()

        gridSizer.Add(rColor,
                      flag=wx.ALIGN_RIGHT |
                      wx.ALIGN_CENTER_VERTICAL,
                      pos=(row, 1))

        gridSizer.AddGrowableCol(0)
        sizer.Add(
            gridSizer,
            proportion=1,
            flag=wx.ALL | wx.EXPAND,
            border=5)
        border.Add(sizer, proportion=0, flag=wx.LEFT |
                   wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)

        panel.SetSizer(border)

        return panel
Ejemplo n.º 30
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
        self.label1 = StaticText(self, id=wx.ID_ANY)
        self.slider = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL)
        self.indexField = TextCtrl(self, id=wx.ID_ANY, size=(40, -1),
                                   style=wx.TE_PROCESS_ENTER | wx.TE_RIGHT,
                                   validator=IntegerValidator())

        self.callbackSliderChanging = None
        self.callbackSliderChanged = None
        self.callbackFrameIndexChanged = None

        self.framesCount = 0

        self.enable = True

        self.slider.Bind(wx.EVT_SPIN, self.OnSliderChanging)
        self.slider.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnSliderChanged)
        self.indexField.Bind(wx.EVT_TEXT_ENTER, self.OnFrameIndexChanged)