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
def __init__(self, parent, title, id=wx.ID_ANY, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): """Dialog for adding column into table """ wx.Dialog.__init__(self, parent, id, title, style=style) self.CenterOnParent() self.data = {} self.data['addColName'] = TextCtrl( parent=self, id=wx.ID_ANY, value='', size=( 150, -1), style=wx.TE_PROCESS_ENTER) self.data['addColType'] = wx.Choice(parent=self, id=wx.ID_ANY, choices=["integer", "double", "varchar", "date"]) # FIXME self.data['addColType'].SetSelection(0) self.data['addColType'].Bind(wx.EVT_CHOICE, self.OnTableChangeType) self.data['addColLength'] = SpinCtrl( parent=self, id=wx.ID_ANY, size=( 65, -1), initial=250, min=1, max=1e6) self.data['addColLength'].Enable(False) # buttons self.btnCancel = Button(self, wx.ID_CANCEL) self.btnOk = Button(self, wx.ID_OK) self.btnOk.SetDefault() self._layout()
def __init__(self, mapframe, statusbar, position=0): SbItem.__init__(self, mapframe, statusbar, position) self.name = "gotoGCP" self.label = _("Pan to GCP by number") self.widget = SpinCtrl(parent=self.statusbar, id=wx.ID_ANY, value="", min=0) self.widget.Hide() self.widget.Bind(wx.EVT_TEXT_ENTER, self.OnGoToGCP) self.widget.Bind(wx.EVT_SPINCTRL, self.OnGoToGCP)
def _createLightPage(self, notebook): """Create notebook page for light settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=" %s " % _("Lighting")) pageSizer = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % (_("Light"))) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(vgap=3, hgap=3) # position posvals = UserSettings.Get(group='nviz', key='light', subkey='position') gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Position:")), pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL) gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) px = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1), initial=posvals['x'] * 100, min=-100, max=100) self.winId['nviz:light:position:x'] = px.GetId() gridSizer.Add(px, pos=(0, 2), flag=wx.ALIGN_CENTER_VERTICAL) gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label="y:"), pos=(0, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) py = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1), initial=posvals['y'] * 100, min=-100, max=100) self.winId['nviz:light:position:y'] = py.GetId() gridSizer.Add(py, pos=(0, 4), flag=wx.ALIGN_CENTER_VERTICAL) gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("z:")), pos=(0, 5), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) pz = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1), initial=posvals['z'], min=0, max=100) self.winId['nviz:light:position:z'] = pz.GetId() gridSizer.Add(pz, pos=(0, 6), flag=wx.ALIGN_CENTER_VERTICAL) # brightness brightval = UserSettings.Get(group='nviz', key='light', subkey='bright') gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Brightness:")), pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL) bright = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1), initial=brightval, min=0, max=100) self.winId['nviz:light:bright'] = bright.GetId() gridSizer.Add(bright, pos=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL) # ambient ambval = UserSettings.Get(group='nviz', key='light', subkey='ambient') gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Ambient:")), pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL) amb = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1), initial=ambval, min=0, max=100) self.winId['nviz:light:ambient'] = amb.GetId() gridSizer.Add(amb, pos=(2, 2), flag=wx.ALIGN_CENTER_VERTICAL) # light color gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:")), pos=(3, 0), flag=wx.ALIGN_CENTER_VERTICAL) color = csel.ColourSelect(panel, id=wx.ID_ANY, colour=UserSettings.Get(group='nviz', key='light', subkey='color'), size=globalvar.DIALOG_COLOR_SIZE) color.SetName('GetColour') self.winId['nviz:light:color'] = color.GetId() gridSizer.Add(color, pos=(3, 2)) 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
def _createAttributesPage(self, notebook): """Create notebook page for attributes""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Attributes")) border = wx.BoxSizer(wx.VERTICAL) # # add new record # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Digitize new feature")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) # checkbox self.addRecord = CheckBox(parent=panel, id=wx.ID_ANY, label=_("Add new record into table")) self.addRecord.SetValue( UserSettings.Get(group="vdigit", key="addRecord", subkey="enabled")) sizer.Add(self.addRecord, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) # settings flexSizer = wx.FlexGridSizer(cols=2, hgap=3, vgap=3) flexSizer.AddGrowableCol(0) settings = ((_("Layer"), 1), (_("Category"), 1), (_("Mode"), _("Next to use"))) # layer text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Layer")) self.layer = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(125, -1), min=1, max=1e3) self.layer.SetValue( int(UserSettings.Get(group="vdigit", key="layer", subkey="value"))) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(self.layer, proportion=0, flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL) # category number text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Category number")) self.category = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(125, -1), initial=UserSettings.Get(group="vdigit", key="category", subkey="value"), min=-1e9, max=1e9, ) if (UserSettings.Get( group="vdigit", key="categoryMode", subkey="selection") != 1): self.category.Enable(False) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add( self.category, proportion=0, flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL, ) # category mode text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Category mode")) self.categoryMode = wx.Choice( parent=panel, id=wx.ID_ANY, size=(125, -1), choices=[_("Next to use"), _("Manual entry"), _("No category")], ) self.categoryMode.SetSelection( UserSettings.Get(group="vdigit", key="categoryMode", subkey="selection")) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add( self.categoryMode, proportion=0, flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL, ) sizer.Add(flexSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=1) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) # # delete existing record # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Delete existing feature(s)")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) # checkbox self.deleteRecord = CheckBox(parent=panel, id=wx.ID_ANY, label=_("Delete record from table")) self.deleteRecord.SetValue( UserSettings.Get(group="vdigit", key="delRecord", subkey="enabled")) sizer.Add(self.deleteRecord, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) border.Add( sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5, ) # # geometry attributes (currently only length and area are supported) # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Geometry attributes")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) self.geomAttrb = { "length": { "label": _("length") }, "area": { "label": _("area") }, "perimeter": { "label": _("perimeter") }, } digitToolbar = self.parent.toolbars["vdigit"] try: vectorName = digitToolbar.GetLayer().GetName() except AttributeError: vectorName = None # no vector selected for editing layer = UserSettings.Get(group="vdigit", key="layer", subkey="value") mapLayer = self.parent.toolbars["vdigit"].GetLayer() tree = self.parent.tree if tree: item = tree.FindItemByData("maplayer", mapLayer) else: item = None row = 0 for attrb in ["length", "area", "perimeter"]: # checkbox check = CheckBox(parent=panel, id=wx.ID_ANY, label=self.geomAttrb[attrb]["label"]) # self.deleteRecord.SetValue(UserSettings.Get(group='vdigit', key="delRecord", subkey='enabled')) check.Bind(wx.EVT_CHECKBOX, self.OnGeomAttrb) # column (only numeric) column = ColumnSelect(parent=panel, size=(200, -1)) column.InsertColumns( vector=vectorName, layer=layer, excludeKey=True, type=["integer", "double precision"], ) # units if attrb == "area": choices = Units.GetUnitsList("area") else: choices = Units.GetUnitsList("length") win_units = wx.Choice(parent=panel, id=wx.ID_ANY, choices=choices, size=(120, -1)) # default values check.SetValue(False) if (item and tree.GetLayerInfo(item, key="vdigit") and "geomAttr" in tree.GetLayerInfo(item, key="vdigit") and attrb in tree.GetLayerInfo(item, key="vdigit")["geomAttr"]): check.SetValue(True) column.SetStringSelection( tree.GetLayerInfo( item, key="vdigit")["geomAttr"][attrb]["column"]) if attrb == "area": type = "area" else: type = "length" unitsIdx = Units.GetUnitsIndex( type, tree.GetLayerInfo( item, key="vdigit")["geomAttr"][attrb]["units"], ) win_units.SetSelection(unitsIdx) if not vectorName: check.Enable(False) column.Enable(False) if not check.IsChecked(): column.Enable(False) self.geomAttrb[attrb]["check"] = check.GetId() self.geomAttrb[attrb]["column"] = column.GetId() self.geomAttrb[attrb]["units"] = win_units.GetId() gridSizer.Add(check, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) gridSizer.Add(column, pos=(row, 1)) gridSizer.Add(win_units, pos=(row, 2)) row += 1 note = "\n".join( textwrap.wrap( _("Note: These settings are stored " "in the workspace not in the vector digitizer " "preferences."), 55, )) gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=note), pos=(3, 0), span=(1, 3)) gridSizer.AddGrowableCol(0) sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=1) border.Add( sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5, ) # bindings self.Bind(wx.EVT_CHECKBOX, self.OnChangeAddRecord, self.addRecord) self.Bind(wx.EVT_CHOICE, self.OnChangeCategoryMode, self.categoryMode) self.Bind(wx.EVT_SPINCTRL, self.OnChangeLayer, self.layer) panel.SetSizer(border) return panel
def _createQueryPage(self, notebook): """Create notebook page for query tool""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Query tool")) border = wx.BoxSizer(wx.VERTICAL) # # query tool box # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Choose query tool")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) LocUnits = self.parent.MapWindow.Map.GetProjInfo()["units"] self.queryBox = CheckBox(parent=panel, id=wx.ID_ANY, label=_("Select by box")) self.queryBox.SetValue( UserSettings.Get(group="vdigit", key="query", subkey="box")) sizer.Add(self.queryBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) sizer.Add((0, 5)) # # length # self.queryLength = wx.RadioButton(parent=panel, id=wx.ID_ANY, label=_("length")) self.queryLength.Bind(wx.EVT_RADIOBUTTON, self.OnChangeQuery) sizer.Add(self.queryLength, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) flexSizer = wx.FlexGridSizer(cols=4, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) txt = StaticText(parent=panel, id=wx.ID_ANY, label=_("Select lines")) self.queryLengthSL = wx.Choice( parent=panel, id=wx.ID_ANY, choices=[_("shorter than"), _("longer than")]) self.queryLengthSL.SetSelection( UserSettings.Get(group="vdigit", key="queryLength", subkey="than-selection")) self.queryLengthValue = FloatSpin( parent=panel, id=wx.ID_ANY, size=(100, -1), value=1, min_val=0, max_val=1e6, digits=7, ) self.queryLengthValue.SetValue( UserSettings.Get(group="vdigit", key="queryLength", subkey="thresh")) units = StaticText(parent=panel, id=wx.ID_ANY, label="%s" % LocUnits) flexSizer.Add(txt, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(self.queryLengthSL, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add(self.queryLengthValue, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add(units, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(flexSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) # # dangle # self.queryDangle = wx.RadioButton(parent=panel, id=wx.ID_ANY, label=_("dangle")) self.queryDangle.Bind(wx.EVT_RADIOBUTTON, self.OnChangeQuery) sizer.Add(self.queryDangle, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) flexSizer = wx.FlexGridSizer(cols=4, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) txt = StaticText(parent=panel, id=wx.ID_ANY, label=_("Select dangles")) self.queryDangleSL = wx.Choice( parent=panel, id=wx.ID_ANY, choices=[_("shorter than"), _("longer than")]) self.queryDangleSL.SetSelection( UserSettings.Get(group="vdigit", key="queryDangle", subkey="than-selection")) self.queryDangleValue = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(100, -1), initial=1, min=0, max=1e6) self.queryDangleValue.SetValue( UserSettings.Get(group="vdigit", key="queryDangle", subkey="thresh")) units = StaticText(parent=panel, id=wx.ID_ANY, label="%s" % LocUnits) flexSizer.Add(txt, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(self.queryDangleSL, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add(self.queryDangleValue, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add(units, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) sizer.Add(flexSizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) if UserSettings.Get(group="vdigit", key="query", subkey="selection") == 0: self.queryLength.SetValue(True) else: self.queryDangle.SetValue(True) # enable & disable items self.OnChangeQuery(None) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) panel.SetSizer(border) return panel
def _createGeneralPage(self, notebook): """Create notebook page concerning general settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("General")) border = wx.BoxSizer(wx.VERTICAL) # # display section # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Display")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) # line width text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Line width")) self.lineWidthValue = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(75, -1), initial=UserSettings.Get(group="vdigit", key="lineWidth", subkey="value"), min=1, max=1e6, ) units = StaticText( parent=panel, id=wx.ID_ANY, size=(115, -1), label=UserSettings.Get(group="vdigit", key="lineWidth", subkey="units"), style=wx.ALIGN_LEFT, ) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(self.lineWidthValue, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add( units, proportion=0, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=10, ) sizer.Add(flexSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=1) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) # # snapping section # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Snapping")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) # snapping text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Snapping threshold")) self.snappingValue = FloatSpin( parent=panel, id=wx.ID_ANY, size=(75, -1), value=UserSettings.Get(group="vdigit", key="snapping", subkey="value"), min_val=-1, max_val=1e6, digits=7, ) self.snappingValue.Bind(wx.EVT_SPINCTRL, self.OnChangeSnappingValue) self.snappingValue.Bind(wx.EVT_TEXT, self.OnChangeSnappingValue) self.snappingUnit = wx.Choice( parent=panel, id=wx.ID_ANY, size=(125, -1), choices=[_("screen pixels"), _("map units")], ) try: self.snappingUnit.SetSelection( UserSettings.Get(group="vdigit", key="snapping", subkey="unit")) except: self.snappingUnit.SetSelection(0) self.snappingUnit.Bind(wx.EVT_CHOICE, self.OnChangeSnappingUnits) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add(self.snappingValue, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE) flexSizer.Add(self.snappingUnit, proportion=0, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE) vertexSizer = wx.BoxSizer(wx.VERTICAL) self.snapVertex = CheckBox(parent=panel, id=wx.ID_ANY, label=_("Snap also to vertex")) self.snapVertex.SetValue( UserSettings.Get(group="vdigit", key="snapToVertex", subkey="enabled")) vertexSizer.Add(self.snapVertex, proportion=0, flag=wx.EXPAND) self.mapUnits = self.parent.MapWindow.Map.GetProjInfo()["units"] self.snappingInfo = StaticText( parent=panel, id=wx.ID_ANY, label=_("Snapping threshold is %(value).1f %(units)s") % { "value": self.digit.GetDisplay().GetThreshold(), "units": self.mapUnits }, ) vertexSizer.Add(self.snappingInfo, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) sizer.Add(flexSizer, proportion=1, flag=wx.EXPAND) sizer.Add(vertexSizer, proportion=1, flag=wx.EXPAND) border.Add( sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5, ) # # select box # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Select vector features")) # feature type sizer = wx.StaticBoxSizer(box, wx.VERTICAL) inSizer = wx.BoxSizer(wx.HORIZONTAL) self.selectFeature = {} for feature in ("point", "line", "centroid", "boundary"): chkbox = CheckBox(parent=panel, label=feature) self.selectFeature[feature] = chkbox.GetId() chkbox.SetValue( UserSettings.Get(group="vdigit", key="selectType", subkey=[feature, "enabled"])) inSizer.Add(chkbox, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) sizer.Add(inSizer, proportion=0, flag=wx.EXPAND) # threshold flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5) flexSizer.AddGrowableCol(0) text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Select threshold")) self.selectThreshValue = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(75, -1), initial=UserSettings.Get(group="vdigit", key="selectThresh", subkey="value"), min=1, max=1e6, ) units = StaticText( parent=panel, id=wx.ID_ANY, size=(115, -1), label=UserSettings.Get(group="vdigit", key="lineWidth", subkey="units"), style=wx.ALIGN_LEFT, ) flexSizer.Add(text, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL) flexSizer.Add( self.selectThreshValue, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE, ) flexSizer.Add( units, proportion=0, flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=10, ) self.selectIn = CheckBox( parent=panel, id=wx.ID_ANY, label=_("Select only features inside of selection bounding box"), ) self.selectIn.SetValue( UserSettings.Get(group="vdigit", key="selectInside", subkey="enabled")) self.selectIn.SetToolTip( _("By default are selected all features overlapping selection bounding box " )) self.checkForDupl = CheckBox(parent=panel, id=wx.ID_ANY, label=_("Check for duplicates")) self.checkForDupl.SetValue( UserSettings.Get(group="vdigit", key="checkForDupl", subkey="enabled")) sizer.Add(flexSizer, proportion=0, flag=wx.EXPAND) sizer.Add(self.selectIn, proportion=0, flag=wx.EXPAND | wx.ALL, border=1) sizer.Add(self.checkForDupl, proportion=0, flag=wx.EXPAND | wx.ALL, border=1) border.Add( sizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, ) # # digitize lines box # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Digitize lines/boundaries")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.intersect = CheckBox(parent=panel, label=_("Break lines at intersection")) self.intersect.SetValue( UserSettings.Get(group="vdigit", key="breakLines", subkey="enabled")) sizer.Add(self.intersect, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) border.Add( sizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, ) # # digitize areas box # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Digitize areas")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.closeBoundary = CheckBox( parent=panel, label=_("Close boundary (snap to the start node)")) self.closeBoundary.SetValue( UserSettings.Get(group="vdigit", key="closeBoundary", subkey="enabled")) sizer.Add(self.closeBoundary, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) border.Add( sizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, ) # # save-on-exit box # box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Save changes")) # save changes on exit? sizer = wx.StaticBoxSizer(box, wx.VERTICAL) self.save = CheckBox(parent=panel, label=_("Save changes on exit")) self.save.SetValue( UserSettings.Get(group="vdigit", key="saveOnExit", subkey="enabled")) sizer.Add(self.save, proportion=0, flag=wx.ALL | wx.EXPAND, border=1) border.Add( sizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, ) panel.SetSizer(border) return panel
def _createActionPage(self, notebook): """Create notebook page for action settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Command")) # colors border = wx.BoxSizer(wx.VERTICAL) box = wx.StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Color")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Valid:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) vColor = csel.ColourSelect(parent=panel, id=wx.ID_ANY, colour=self.settings.Get(group='modeler', key='action', subkey=('color', 'valid')), size=globalvar.DIALOG_COLOR_SIZE) vColor.SetName('GetColour') self.winId['modeler:action:color:valid'] = vColor.GetId() gridSizer.Add(item=vColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Invalid:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) iColor = csel.ColourSelect(parent=panel, id=wx.ID_ANY, colour=self.settings.Get( group='modeler', key='action', subkey=('color', 'invalid')), size=globalvar.DIALOG_COLOR_SIZE) iColor.SetName('GetColour') self.winId['modeler:action:color:invalid'] = iColor.GetId() gridSizer.Add(item=iColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Running:")), 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='action', subkey=('color', 'running')), size=globalvar.DIALOG_COLOR_SIZE) rColor.SetName('GetColour') self.winId['modeler:action:color:running'] = rColor.GetId() gridSizer.Add(item=rColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) gridSizer.AddGrowableCol(0) sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5) border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3) # size box = wx.StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Shape size")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Width:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) width = SpinCtrl(parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get(group='modeler', key='action', subkey=('size', 'width'))) width.SetName('GetValue') self.winId['modeler:action:size:width'] = width.GetId() gridSizer.Add(item=width, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Height:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) height = SpinCtrl(parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get(group='modeler', key='action', subkey=('size', 'height'))) height.SetName('GetValue') self.winId['modeler:action:size:height'] = height.GetId() gridSizer.Add(item=height, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) gridSizer.AddGrowableCol(0) sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5) border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3) panel.SetSizer(border) return panel
def __init__(self, parent, title, data, keyEditable=(-1, True), id=wx.ID_ANY, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): """Dialog for inserting/updating table record :param data: a list: [(column, value)] :param keyEditable: (id, editable?) indicates if textarea for key column is editable(True) or not """ # parent -> VDigitWindow wx.Dialog.__init__(self, parent, id, title, style=style) self.CenterOnParent() self.keyId = keyEditable[0] box = StaticBox(parent=self, id=wx.ID_ANY) box.Hide() self.dataPanel = scrolled.ScrolledPanel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.dataPanel.SetupScrolling(scroll_x=False) # buttons self.btnCancel = Button(self, wx.ID_CANCEL) self.btnSubmit = Button(self, wx.ID_OK, _("&Submit")) self.btnSubmit.SetDefault() # data area self.widgets = [] cId = 0 self.usebox = False self.cat = None winFocus = False for column, ctype, ctypeStr, value in data: if self.keyId == cId: self.cat = int(value) if not keyEditable[1]: self.usebox = True box.SetLabel(" %s %d " % (_("Category"), self.cat)) box.Show() self.boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) cId += 1 continue else: valueWin = SpinCtrl(parent=self.dataPanel, id=wx.ID_ANY, value=value, min=-1e9, max=1e9, size=(250, -1)) else: valueWin = TextCtrl(parent=self.dataPanel, id=wx.ID_ANY, value=value, size=(250, -1)) if ctype == int: valueWin.SetValidator(IntegerValidator()) elif ctype == float: valueWin.SetValidator(FloatValidator()) if not winFocus: wx.CallAfter(valueWin.SetFocus) winFocus = True label = StaticText(parent=self.dataPanel, id=wx.ID_ANY, label=column) ctype = StaticText(parent=self.dataPanel, id=wx.ID_ANY, label="[%s]:" % ctypeStr.lower()) self.widgets.append( (label.GetId(), ctype.GetId(), valueWin.GetId())) cId += 1 self._layout()
def _advancedSettsPage(self): """Create advanced settings page """ # TODO parse maxcol, maxrow, settings from d.wms module? # TODO OnEarth driver - add selection of time adv_setts_panel = ScrolledPanel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER) self.notebook.AddPage(page=adv_setts_panel, text=_('Advanced request settings'), name='adv_req_setts') labels = {} self.l_odrder_list = None if 'WMS' in self.ws: labels['l_order'] = StaticBox( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Order of layers in raster")) self.l_odrder_list = wx.ListBox( adv_setts_panel, id=wx.ID_ANY, choices=[], style=wx.LB_SINGLE | wx.LB_NEEDED_SB) self.btnUp = Button( adv_setts_panel, id=wx.ID_ANY, label=_("Up")) self.btnDown = Button( adv_setts_panel, id=wx.ID_ANY, label=_("Down")) self.btnUp.Bind(wx.EVT_BUTTON, self.OnUp) self.btnDown.Bind(wx.EVT_BUTTON, self.OnDown) labels['method'] = StaticText(parent=adv_setts_panel, id=wx.ID_ANY, label=_("Reprojection method:")) self.reproj_methods = ['nearest', 'linear', 'cubic', 'cubicspline'] self.params['method'] = wx.Choice( parent=adv_setts_panel, id=wx.ID_ANY, choices=[ _('Nearest neighbor'), _('Linear interpolation'), _('Cubic interpolation'), _('Cubic spline interpolation')]) labels['maxcols'] = StaticText( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Maximum columns to request from server at time:")) self.params['maxcols'] = SpinCtrl( parent=adv_setts_panel, id=wx.ID_ANY, size=(100, -1)) labels['maxrows'] = StaticText( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Maximum rows to request from server at time:")) self.params['maxrows'] = SpinCtrl( parent=adv_setts_panel, id=wx.ID_ANY, size=(100, -1)) min = 100 max = 10000 self.params['maxcols'].SetRange(min, max) self.params['maxrows'].SetRange(min, max) val = 500 self.params['maxcols'].SetValue(val) self.params['maxrows'].SetValue(val) self.flags['o'] = self.params['bgcolor'] = None if 'o' not in self.drv_props['ignored_flags']: self.flags['o'] = wx.CheckBox( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Do not request transparent data")) self.flags['o'].Bind(wx.EVT_CHECKBOX, self.OnTransparent) labels['bgcolor'] = StaticText( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Background color:")) self.params['bgcolor'] = csel.ColourSelect( parent=adv_setts_panel, id=wx.ID_ANY, colour=( 255, 255, 255), size=globalvar.DIALOG_COLOR_SIZE) self.params['bgcolor'].Enable(False) self.params['urlparams'] = None if self.params['urlparams'] not in self.drv_props['ignored_params']: labels['urlparams'] = StaticText( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Additional query parameters for server:")) self.params['urlparams'] = TextCtrl( parent=adv_setts_panel, id=wx.ID_ANY) # layout border = wx.BoxSizer(wx.VERTICAL) if 'WMS' in self.ws: boxSizer = wx.StaticBoxSizer(labels['l_order'], wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) gridSizer.Add(self.l_odrder_list, pos=(0, 0), span=(4, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, border=0) gridSizer.Add(self.btnUp, pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL, border=0) gridSizer.Add(self.btnDown, pos=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL, border=0) gridSizer.AddGrowableCol(0) boxSizer.Add(gridSizer, flag=wx.EXPAND | wx.ALL, border=5) border.Add(boxSizer, flag=wx.LEFT | wx.RIGHT | wx.UP | wx.EXPAND, border=5) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 for k in ['method', 'maxcols', 'maxrows', 'o', 'bgcolor']: if k in self.params: param = self.params[k] elif k in self.flags: param = self.flags[k] if param is None: continue if k in labels or k == 'o': if k != 'o': label = labels[k] else: label = param gridSizer.Add(label, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) if k != 'o': gridSizer.Add(param, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.AddGrowableCol(0) border.Add(gridSizer, flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, border=5) if self.params['urlparams']: gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 gridSizer.Add(labels['urlparams'], flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) gridSizer.Add(self.params['urlparams'], flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1)) gridSizer.AddGrowableCol(1) border.Add(gridSizer, flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, border=5) adv_setts_panel.SetSizer(border) adv_setts_panel.SetAutoLayout(True) adv_setts_panel.SetupScrolling()
def _createMirrorModePage(self, notebook): """Create notebook page for general settings""" panel = SP.ScrolledPanel(parent=notebook) panel.SetupScrolling(scroll_x=False, scroll_y=True) notebook.AddPage(page=panel, text=_("Mirror mode")) border = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, label=" %s " % _("Mirrored cursor")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) row = 0 gridSizer.Add( StaticText(parent=panel, label=_("Color:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) color = csel.ColourSelect( parent=panel, colour=UserSettings.Get(group="mapswipe", key="cursor", subkey="color"), size=globalvar.DIALOG_COLOR_SIZE, ) color.SetName("GetColour") self.winId["mapswipe:cursor:color"] = color.GetId() gridSizer.Add(color, pos=(row, 1), flag=wx.ALIGN_RIGHT) row += 1 gridSizer.Add( StaticText(parent=panel, label=_("Shape:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) cursors = wx.Choice( parent=panel, choices=self.settings.Get( group="mapswipe", key="cursor", subkey=["type", "choices"], settings_type="internal", ), name="GetSelection", ) cursors.SetSelection( self.settings.Get( group="mapswipe", key="cursor", subkey=["type", "selection"] ) ) self.winId["mapswipe:cursor:type:selection"] = cursors.GetId() gridSizer.Add( cursors, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1), ) row += 1 gridSizer.Add( StaticText(parent=panel, label=_("Line width:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) width = SpinCtrl( parent=panel, min=1, max=10, initial=self.settings.Get(group="mapswipe", key="cursor", subkey="width"), name="GetValue", ) self.winId["mapswipe:cursor:width"] = width.GetId() gridSizer.Add( width, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1), ) row += 1 gridSizer.Add( StaticText(parent=panel, label=_("Size:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) size = SpinCtrl( parent=panel, min=4, max=50, initial=self.settings.Get(group="mapswipe", key="cursor", subkey="size"), name="GetValue", ) self.winId["mapswipe:cursor:size"] = size.GetId() gridSizer.Add( size, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, pos=(row, 1), ) gridSizer.AddGrowableCol(1) sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=3) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3) panel.SetSizer(border) return panel
def _createDataPage(self, notebook): """Create notebook page for data settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Data")) # colors border = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Type")) 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=_("Raster:")), 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='data', subkey=( 'color', 'raster')), size=globalvar.DIALOG_COLOR_SIZE) rColor.SetName('GetColour') self.winId['modeler:data:color:raster'] = rColor.GetId() gridSizer.Add(rColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("3D raster:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) r3Color = csel.ColourSelect( parent=panel, id=wx.ID_ANY, colour=self.settings.Get( group='modeler', key='data', subkey=( 'color', 'raster3d')), size=globalvar.DIALOG_COLOR_SIZE) r3Color.SetName('GetColour') self.winId['modeler:data:color:raster3d'] = r3Color.GetId() gridSizer.Add(r3Color, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Vector:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) vColor = csel.ColourSelect( parent=panel, id=wx.ID_ANY, colour=self.settings.Get( group='modeler', key='data', subkey=( 'color', 'vector')), size=globalvar.DIALOG_COLOR_SIZE) vColor.SetName('GetColour') self.winId['modeler:data:color:vector'] = vColor.GetId() gridSizer.Add(vColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Table:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) tColor = csel.ColourSelect( parent=panel, id=wx.ID_ANY, colour=self.settings.Get( group='modeler', key='data', subkey=( 'color', 'dbtable')), size=globalvar.DIALOG_COLOR_SIZE) tColor.SetName('GetColour') self.winId['modeler:data:color:dbtable'] = tColor.GetId() gridSizer.Add(tColor, 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) # size box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Shape size")) 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=_("Width:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) width = SpinCtrl( parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get( group='modeler', key='data', subkey=( 'size', 'width'))) width.SetName('GetValue') self.winId['modeler:data:size:width'] = width.GetId() gridSizer.Add(width, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY, label=_("Height:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) height = SpinCtrl( parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get( group='modeler', key='data', subkey=( 'size', 'height'))) height.SetName('GetValue') self.winId['modeler:data:size:height'] = height.GetId() gridSizer.Add(height, 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
def _createViewPage(self, notebook): """Create notebook page for view settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=" %s " % _("View")) pageSizer = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % (_("View"))) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(vgap=3, hgap=3) row = 0 # perspective pvals = UserSettings.Get(group="nviz", key="view", subkey="persp") ipvals = UserSettings.Get( group="nviz", key="view", subkey="persp", settings_type="internal" ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Perspective:")), pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL, ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) pval = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=pvals["value"], min=ipvals["min"], max=ipvals["max"], ) self.winId["nviz:view:persp:value"] = pval.GetId() gridSizer.Add(pval, pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("step:")), pos=(row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) pstep = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=pvals["step"], min=ipvals["min"], max=ipvals["max"] - 1, ) self.winId["nviz:view:persp:step"] = pstep.GetId() gridSizer.Add(pstep, pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL) row += 1 # position posvals = UserSettings.Get(group="nviz", key="view", subkey="position") gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Position:")), pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL, ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) px = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=posvals["x"] * 100, min=0, max=100, ) self.winId["nviz:view:position:x"] = px.GetId() gridSizer.Add(px, pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label="y:"), pos=(row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) py = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=posvals["y"] * 100, min=0, max=100, ) self.winId["nviz:view:position:y"] = py.GetId() gridSizer.Add(py, pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL) row += 1 # height is computed dynamically # twist tvals = UserSettings.Get(group="nviz", key="view", subkey="twist") itvals = UserSettings.Get( group="nviz", key="view", subkey="twist", settings_type="internal" ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Twist:")), pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL, ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) tval = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=tvals["value"], min=itvals["min"], max=itvals["max"], ) self.winId["nviz:view:twist:value"] = tval.GetId() gridSizer.Add(tval, pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL) row += 1 # z-exag zvals = UserSettings.Get(group="nviz", key="view", subkey="z-exag") gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Z-exag:")), pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL, ) gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, ) zval = SpinCtrl( parent=panel, id=wx.ID_ANY, size=(65, -1), initial=zvals["value"], min=-1e6, max=1e6, ) self.winId["nviz:view:z-exag:value"] = zval.GetId() gridSizer.Add(zval, pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL) boxSizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=3) pageSizer.Add( boxSizer, proportion=0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=3, ) box = StaticBox( parent=panel, id=wx.ID_ANY, label=" %s " % (_("Image Appearance")) ) boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(vgap=3, hgap=3) # background color gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Background color:")), pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL, ) color = csel.ColourSelect( panel, id=wx.ID_ANY, colour=UserSettings.Get( group="nviz", key="view", subkey=["background", "color"] ), size=globalvar.DIALOG_COLOR_SIZE, ) color.SetName("GetColour") self.winId["nviz:view:background:color"] = color.GetId() gridSizer.Add(color, pos=(0, 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
def __init__(self, parent, *args, **kwargs): wx.Panel.__init__(self, parent, *args, **kwargs) self.parent = parent self.VariogramSizer = wx.StaticBoxSizer( wx.StaticBox(self, id=wx.ID_ANY, label=_("Variogram fitting")), wx.HORIZONTAL, ) self.LeftSizer = wx.BoxSizer(wx.VERTICAL) self.RightSizer = wx.BoxSizer(wx.VERTICAL) self.ParametersSizer = wx.GridBagSizer(vgap=5, hgap=5) self.VariogramSizer.Add(self.LeftSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) self.VariogramSizer.Add(self.RightSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border) # left side of Variogram fitting. The checkboxes and spinctrls. # no stock ID for Run button.. self.PlotButton = wx.Button(self, id=wx.ID_ANY, label=_("Plot/refresh variogram")) self.PlotButton.Bind(wx.EVT_BUTTON, self.OnPlotButton) # grey it out until a suitable layer is available self.PlotButton.Enable(False) self.LeftSizer.Add(self.PlotButton, proportion=0, flag=wx.ALL, border=parent.border) self.LeftSizer.Add( self.ParametersSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border, ) self.ParametersList = ["Psill", "Nugget", "Range", "Kappa"] MinValues = [0, 0, 0.01, 0.01] InitialValues = [1, 0, 1, 0.5] for n in self.ParametersList: setattr( self, n + "ChextBox", wx.CheckBox(self, id=self.ParametersList.index(n), label=_(n + ":")), ) setattr( self, n + "Ctrl", (wx.SpinCtrlDouble( self, id=wx.ID_ANY, min=MinValues[self.ParametersList.index(n)], max=maxint, inc=0.1, initial=InitialValues[self.ParametersList.index(n)], )), ) getattr(self, n + "ChextBox").Bind(wx.EVT_CHECKBOX, self.UseValue, id=self.ParametersList.index(n)) setattr(self, n + "Sizer", (wx.BoxSizer(wx.HORIZONTAL))) self.ParametersSizer.Add( getattr(self, n + "ChextBox"), flag=wx.ALIGN_CENTER_VERTICAL, pos=(self.ParametersList.index(n), 0), ) self.ParametersSizer.Add( getattr(self, n + "Ctrl"), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, pos=(self.ParametersList.index(n), 1), ) # right side of the Variogram fitting. The plot area. # Plot = wx.StaticText(self, id= wx.ID_ANY, label = "Check Plot Variogram to interactively fit model.") # PlotPanel = wx.Panel(self) # self.PlotArea = plot.PlotCanvas(PlotPanel) # self.PlotArea.SetInitialSize(size = (250,250)) # self.RightSizer.Add(PlotPanel, proportion=0, flag= wx.EXPAND|wx.ALL, border=parent.border) self.KrigingSizer = wx.StaticBoxSizer( wx.StaticBox(self, id=wx.ID_ANY, label=_("Kriging techniques")), wx.VERTICAL) # , "Universal kriging"] #@FIXME: i18n on the list? KrigingList = ["Ordinary kriging", "Block kriging"] self.KrigingRadioBox = wx.RadioBox( self, id=wx.ID_ANY, choices=KrigingList, majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.KrigingRadioBox.Bind(wx.EVT_RADIOBOX, self.HideBlockOptions) self.KrigingSizer.Add( self.KrigingRadioBox, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border, ) # block kriging parameters. Size. BlockSizer = wx.BoxSizer(wx.HORIZONTAL) BlockLabel = wx.StaticText(self, id=wx.ID_ANY, label=_("Block size:")) self.BlockSpinBox = SpinCtrl(self, id=wx.ID_ANY, min=1, max=maxint) # default choice is Ordinary kriging so block param is disabled self.BlockSpinBox.Enable(False) BlockSizer.Add(BlockLabel, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border) BlockSizer.Add( self.BlockSpinBox, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border, ) self.KrigingSizer.Add( BlockSizer, flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=parent.border, ) self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add( self.VariogramSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border, ) self.Sizer.Add( self.KrigingSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=parent.border, )
def _createActionPage(self, notebook): """Create notebook page for action settings""" panel = wx.Panel(parent=notebook, id=wx.ID_ANY) notebook.AddPage(page=panel, text=_("Command")) # colors border = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Color")) 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=_("Valid:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) vColor = csel.ColourSelect( parent=panel, id=wx.ID_ANY, colour=self.settings.Get(group="modeler", key="action", subkey=("color", "valid")), size=globalvar.DIALOG_COLOR_SIZE, ) vColor.SetName("GetColour") self.winId["modeler:action:color:valid"] = vColor.GetId() gridSizer.Add(vColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Invalid:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) iColor = csel.ColourSelect( parent=panel, id=wx.ID_ANY, colour=self.settings.Get(group="modeler", key="action", subkey=("color", "invalid")), size=globalvar.DIALOG_COLOR_SIZE, ) iColor.SetName("GetColour") self.winId["modeler:action:color:invalid"] = iColor.GetId() gridSizer.Add(iColor, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Running:")), 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="action", subkey=("color", "running")), size=globalvar.DIALOG_COLOR_SIZE, ) rColor.SetName("GetColour") self.winId["modeler:action:color:running"] = 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, ) # size box = StaticBox(parent=panel, id=wx.ID_ANY, label=" %s " % _("Shape size")) 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=_("Width:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) width = SpinCtrl( parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get(group="modeler", key="action", subkey=("size", "width")), ) width.SetName("GetValue") self.winId["modeler:action:size:width"] = width.GetId() gridSizer.Add(width, flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 1)) row += 1 gridSizer.Add( StaticText(parent=panel, id=wx.ID_ANY, label=_("Height:")), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0), ) height = SpinCtrl( parent=panel, id=wx.ID_ANY, min=0, max=500, initial=self.settings.Get(group="modeler", key="action", subkey=("size", "height")), ) height.SetName("GetValue") self.winId["modeler:action:size:height"] = height.GetId() gridSizer.Add(height, 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