2 @package wxplot.dialogs
4 @brief Dialogs for different plotting routines
7 - dialogs::ProfileRasterDialog
8 - dialogs::ScatterRasterDialog
9 - dialogs::PlotStatsFrame
10 - dialogs::HistRasterDialog
14 (C) 2011-2012 by the GRASS Development Team
16 This program is free software under the GNU General Public License
17 (>=v2). Read the file COPYING that comes with GRASS for details.
19 @author Michael Barton, Arizona State University
23 import wx.lib.colourselect
as csel
24 import wx.lib.scrolledpanel
as scrolled
26 from core
import globalvar
33 def __init__(self, parent, id = wx.ID_ANY,
34 title = _(
"Select raster maps to profile"),
35 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
36 """!Dialog to select raster maps to profile.
39 wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
43 self.
colorList = [
"blue",
"red",
"green",
"yellow",
"magenta",
"cyan", \
44 "aqua",
"black",
"grey",
"orange",
"brown",
"purple",
"violet", \
53 sizer = wx.BoxSizer(wx.VERTICAL)
55 box = wx.GridBagSizer (hgap = 3, vgap = 3)
61 rastText = rastText.rstrip(
',')
63 txt = _(
"Select raster map(s) to profile:")
64 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = txt)
66 flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
68 selection = Select(self, id = wx.ID_ANY,
69 size = globalvar.DIALOG_GSELECT_SIZE,
70 type =
'cell', multiple=
True)
71 selection.SetValue(rastText)
74 box.Add(item = selection, pos = (0, 1))
76 sizer.Add(item = box, proportion = 0,
77 flag = wx.ALL, border = 10)
79 line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
80 sizer.Add(item = line, proportion = 0,
81 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
83 btnsizer = wx.StdDialogButtonSizer()
85 btn = wx.Button(self, wx.ID_OK)
87 btnsizer.AddButton(btn)
89 btn = wx.Button(self, wx.ID_CANCEL)
90 btnsizer.AddButton(btn)
93 sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
99 """!Choose maps to profile. Convert these into a list
104 def __init__(self, parent, id, message = '', title = '',
105 style = wx.DEFAULT_FRAME_STYLE, **kwargs):
106 """!Dialog to display and save statistics for plots
108 wx.Frame.__init__(self, parent, id, style = style, **kwargs)
109 self.SetLabel(_(
"Statistics"))
111 sp = scrolled.ScrolledPanel(self, -1, size=(400, 400),
112 style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER, name=
"Statistics" )
121 self.CenterOnParent()
126 sizer = wx.BoxSizer(wx.VERTICAL)
127 txtSizer = wx.BoxSizer(wx.VERTICAL)
129 statstitle = wx.StaticText(parent = self, id = wx.ID_ANY, label = self.
title)
130 sizer.Add(item = statstitle, proportion = 0,
131 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 3)
132 line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
133 sizer.Add(item = line, proportion = 0,
134 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 3)
136 statstxt = wx.StaticText(parent = sp, id = wx.ID_ANY, label = stats)
137 statstxt.SetBackgroundColour(
"WHITE")
138 txtSizer.Add(item = statstxt, proportion = 1,
139 flag = wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
140 line = wx.StaticLine(parent = sp, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
141 txtSizer.Add(item = line, proportion = 0,
142 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 3)
144 sp.SetSizer(txtSizer)
148 sizer.Add(item = sp, proportion = 1,
149 flag = wx.GROW | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 3)
151 line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
152 sizer.Add(item = line, proportion = 0,
153 flag = wx.GROW |wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
158 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
160 btn_clipboard = wx.Button(self, id = wx.ID_COPY, label = _(
'C&opy'))
161 btn_clipboard.SetToolTipString(_(
"Copy regression statistics the clipboard (Ctrl+C)"))
162 btnSizer.Add(item = btn_clipboard, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
164 btnCancel = wx.Button(self, wx.ID_CLOSE)
165 btnCancel.SetDefault()
166 btnSizer.Add(item = btnCancel, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
168 sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
171 btnCancel.Bind(wx.EVT_BUTTON, self.
OnClose)
172 btn_clipboard.Bind(wx.EVT_BUTTON, self.
OnCopy)
178 """!Copy the regression stats to the clipboard
180 str = self.
title +
'\n'
184 rdata = wx.TextDataObject()
187 if wx.TheClipboard.Open():
188 wx.TheClipboard.SetData(rdata)
189 wx.TheClipboard.Close()
190 wx.MessageBox(_(
"Regression statistics copied to clipboard"))
193 """!Button 'Close' pressed
198 def __init__(self, parent, id, title, plottype = '',
199 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
200 """!Dialog to set plot text options: font, title
201 and font size, axis labels and font size
203 wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
209 'decorative' : wx.FONTFAMILY_DECORATIVE,
210 'roman' : wx.FONTFAMILY_ROMAN,
211 'script' : wx.FONTFAMILY_SCRIPT,
212 'swiss' : wx.FONTFAMILY_SWISS,
213 'modern' : wx.FONTFAMILY_MODERN,
214 'teletype' : wx.FONTFAMILY_TELETYPE }
217 'slant' : wx.FONTSTYLE_SLANT,
218 'italic' : wx.FONTSTYLE_ITALIC }
220 self.
fwtdict = {
'normal' : wx.FONTWEIGHT_NORMAL,
221 'light' : wx.FONTWEIGHT_LIGHT,
222 'bold' : wx.FONTWEIGHT_BOLD }
240 def _do_layout(self):
243 sizer = wx.BoxSizer(wx.VERTICAL)
245 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
246 label =
" %s " % _(
"Text settings"))
247 boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
248 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
253 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Profile title:"))
254 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
255 self.
ptitleentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (250,-1))
257 self.ptitleentry.SetValue(self.
ptitle)
258 gridSizer.Add(item = self.
ptitleentry, pos = (0, 1))
263 tlabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Title font size (pts):"))
264 gridSizer.Add(item = tlabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
265 self.
ptitlesize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value =
"", pos = (30, 50),
266 size = (50,-1), style = wx.SP_ARROW_KEYS)
267 self.ptitlesize.SetRange(5,100)
268 self.ptitlesize.SetValue(int(self.
properties[
'font'][
'prop'][
'titleSize']))
269 gridSizer.Add(item = self.
ptitlesize, pos = (1, 1))
274 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"X-axis label:"))
275 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
276 self.
xlabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (250,-1))
278 self.xlabelentry.SetValue(self.
xlabel)
279 gridSizer.Add(item = self.
xlabelentry, pos = (2, 1))
284 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Y-axis label:"))
285 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
286 self.
ylabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (250,-1))
288 self.ylabelentry.SetValue(self.
ylabel)
289 gridSizer.Add(item = self.
ylabelentry, pos = (3, 1))
294 llabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Label font size (pts):"))
295 gridSizer.Add(item = llabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
296 self.
axislabelsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value =
"", pos = (30, 50),
297 size = (50, -1), style = wx.SP_ARROW_KEYS)
298 self.axislabelsize.SetRange(5, 100)
299 self.axislabelsize.SetValue(int(self.
properties[
'font'][
'prop'][
'axisSize']))
302 boxSizer.Add(item = gridSizer)
303 sizer.Add(item = boxSizer, flag = wx.ALL | wx.EXPAND, border = 3)
308 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
309 label =
" %s " % _(
"Font settings"))
310 boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
311 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
312 gridSizer.AddGrowableCol(1)
317 label1 = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Font family:"))
318 gridSizer.Add(item = label1, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
319 self.
ffamilycb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
320 choices = self.ffamilydict.keys(), style = wx.CB_DROPDOWN)
321 self.ffamilycb.SetStringSelection(
'swiss')
322 for item
in self.ffamilydict.items():
324 self.ffamilycb.SetStringSelection(item[0])
326 gridSizer.Add(item = self.
ffamilycb, pos = (0, 1), flag = wx.ALIGN_RIGHT)
331 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Style:"))
332 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
333 self.
fstylecb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
334 choices = self.fstyledict.keys(), style = wx.CB_DROPDOWN)
335 self.fstylecb.SetStringSelection(
'normal')
336 for item
in self.fstyledict.items():
338 self.fstylecb.SetStringSelection(item[0])
340 gridSizer.Add(item = self.
fstylecb, pos = (1, 1), flag = wx.ALIGN_RIGHT)
345 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Weight:"))
346 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
347 self.
fwtcb = wx.ComboBox(parent = self, size = (250, -1),
348 choices = self.fwtdict.keys(), style = wx.CB_DROPDOWN)
349 self.fwtcb.SetStringSelection(
'normal')
350 for item
in self.fwtdict.items():
352 self.fwtcb.SetStringSelection(item[0])
355 gridSizer.Add(item = self.
fwtcb, pos = (2, 1), flag = wx.ALIGN_RIGHT)
357 boxSizer.Add(item = gridSizer, flag = wx.EXPAND)
358 sizer.Add(item = boxSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
360 line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
361 sizer.Add(item = line, proportion = 0,
362 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
367 btnSave = wx.Button(self, wx.ID_SAVE)
368 btnApply = wx.Button(self, wx.ID_APPLY)
369 btnOk = wx.Button(self, wx.ID_OK)
370 btnCancel = wx.Button(self, wx.ID_CANCEL)
374 btnApply.Bind(wx.EVT_BUTTON, self.
OnApply)
375 btnApply.SetToolTipString(_(
"Apply changes for the current session"))
376 btnOk.Bind(wx.EVT_BUTTON, self.
OnOk)
377 btnOk.SetToolTipString(_(
"Apply changes for the current session and close dialog"))
379 btnSave.Bind(wx.EVT_BUTTON, self.
OnSave)
380 btnSave.SetToolTipString(_(
"Apply and save changes to user settings file (default for next sessions)"))
381 btnCancel.Bind(wx.EVT_BUTTON, self.
OnCancel)
382 btnCancel.SetToolTipString(_(
"Close dialog and ignore changes"))
385 btnStdSizer = wx.StdDialogButtonSizer()
386 btnStdSizer.AddButton(btnOk)
387 btnStdSizer.AddButton(btnApply)
388 btnStdSizer.AddButton(btnCancel)
389 btnStdSizer.Realize()
391 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
392 btnSizer.Add(item = btnSave, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
393 btnSizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
394 sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
399 self.ptitleentry.Bind(wx.EVT_TEXT, self.
OnTitle)
400 self.xlabelentry.Bind(wx.EVT_TEXT, self.
OnXLabel)
401 self.ylabelentry.Bind(wx.EVT_TEXT, self.
OnYLabel)
407 self.
ptitle = event.GetString()
410 self.
xlabel = event.GetString()
413 self.
ylabel = event.GetString()
416 self.
properties[
'font'][
'prop'][
'titleSize'] = self.ptitlesize.GetValue()
417 self.
properties[
'font'][
'prop'][
'axisSize'] = self.axislabelsize.GetValue()
419 family = self.
ffamilydict[self.ffamilycb.GetStringSelection()]
420 self.
properties[
'font'][
'wxfont'].SetFamily(family)
421 style = self.
fstyledict[self.fstylecb.GetStringSelection()]
422 self.
properties[
'font'][
'wxfont'].SetStyle(style)
423 weight = self.
fwtdict[self.fwtcb.GetStringSelection()]
424 self.
properties[
'font'][
'wxfont'].SetWeight(weight)
427 """!Button 'Save' pressed"""
430 UserSettings.ReadSettingsFile(settings = fileSettings)
432 UserSettings.SaveToFile(fileSettings)
433 self.parent.parent.GetLayerManager().goutput.WriteLog(_(
'Plot text sizes saved to file \'%s\'.') % UserSettings.filePath)
434 self.EndModal(wx.ID_OK)
437 """!Button 'Apply' pressed"""
439 self.parent.OnPlotText(self)
442 """!Button 'OK' pressed"""
444 self.EndModal(wx.ID_OK)
447 """!Button 'Cancel' pressed"""
448 self.EndModal(wx.ID_CANCEL)
451 def __init__(self, parent, id, title, plottype = '',
452 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
453 """!Dialog to set various options for data plotted, including: line
454 width, color, style; marker size, color, fill, and style; grid
457 wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
490 wx.MessageBox(parent = self,
491 message = _(
"No map or image group selected to plot."),
492 caption = _(
"Warning"), style = wx.OK | wx.ICON_ERROR)
496 def _do_layout(self):
497 """!Options dialog layout
499 sizer = wx.BoxSizer(wx.VERTICAL)
501 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
502 label =
" %s " % _(
"Plot settings"))
503 boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
505 self.
wxId[
'pcolor'] = 0
506 self.
wxId[
'pwidth'] = 0
507 self.
wxId[
'pstyle'] = 0
508 self.
wxId[
'psize'] = 0
509 self.
wxId[
'ptype'] = 0
510 self.
wxId[
'pfill'] = 0
511 self.
wxId[
'plegend'] = 0
512 self.
wxId[
'marker'] = {}
513 self.
wxId[
'x-axis'] = {}
514 self.
wxId[
'y-axis'] = {}
521 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
522 label = _(
"Map/image plotted"))
523 boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
525 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
530 choicelist.append(str(i))
532 self.
mapchoice = wx.Choice(parent = self, id = wx.ID_ANY, size = (300, -1),
533 choices = choicelist)
534 self.mapchoice.SetToolTipString(_(
"Settings for selected map"))
537 self.
map = self.
rasterList[self.mapchoice.GetCurrentSelection()]
539 self.mapchoice.SetStringSelection(str(self.
map))
542 gridSizer.Add(item = self.
mapchoice, flag = wx.ALIGN_CENTER_VERTICAL,
543 pos = (row, 0), span = (1, 2))
549 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Line color"))
550 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
551 color = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.
raster[self.
map][
'pcolor'])
552 self.
wxId[
'pcolor'] = color.GetId()
553 gridSizer.Add(item = color, pos = (row, 1))
556 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Line width"))
557 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
558 width = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value =
"",
559 size = (50,-1), style = wx.SP_ARROW_KEYS)
560 width.SetRange(1, 10)
561 width.SetValue(self.
raster[self.
map][
'pwidth'])
562 self.
wxId[
'pwidth'] = width.GetId()
563 gridSizer.Add(item = width, pos = (row, 1))
566 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Line style"))
567 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
568 style = wx.Choice(parent = self, id = wx.ID_ANY,
569 size = (120, -1), choices = self.linestyledict.keys())
570 style.SetStringSelection(self.
raster[self.
map][
'pstyle'])
571 self.
wxId[
'pstyle'] = style.GetId()
572 gridSizer.Add(item = style, pos = (row, 1))
575 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Legend"))
576 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
577 legend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (200,-1))
578 legend.SetValue(self.
raster[self.
map][
'plegend'])
579 gridSizer.Add(item = legend, pos = (row, 1))
580 self.
wxId[
'plegend'] = legend.GetId()
582 boxSizer.Add(item = gridSizer)
583 boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
588 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
589 label =
" %s " % _(
"Transect segment marker settings"))
591 boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
593 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
594 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Color"))
595 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
596 ptcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.
properties[
'marker'][
'color'])
597 self.
wxId[
'marker'][
'color'] = ptcolor.GetId()
598 gridSizer.Add(item = ptcolor, pos = (0, 1))
600 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Size"))
601 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
602 ptsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value =
"",
603 size = (50, -1), style = wx.SP_ARROW_KEYS)
604 ptsize.SetRange(1, 10)
605 ptsize.SetValue(self.
properties[
'marker'][
'size'])
606 self.
wxId[
'marker'][
'size'] = ptsize.GetId()
607 gridSizer.Add(item = ptsize, pos = (1, 1))
609 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Fill"))
610 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
611 ptfill = wx.Choice(parent = self, id = wx.ID_ANY,
612 size = (120, -1), choices = self.ptfilldict.keys())
613 ptfill.SetStringSelection(self.
properties[
'marker'][
'fill'])
614 self.
wxId[
'marker'][
'fill'] = ptfill.GetId()
615 gridSizer.Add(item = ptfill, pos = (2, 1))
617 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Legend"))
618 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
619 ptlegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (200,-1))
620 ptlegend.SetValue(self.
properties[
'marker'][
'legend'])
621 self.
wxId[
'marker'][
'legend'] = ptlegend.GetId()
622 gridSizer.Add(item = ptlegend, pos = (3, 1))
624 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Style"))
625 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
626 pttype = wx.Choice(parent = self, size = (200, -1), choices = self.
pttypelist)
627 pttype.SetStringSelection(self.
properties[
'marker'][
'type'])
628 self.
wxId[
'marker'][
'type'] = pttype.GetId()
629 gridSizer.Add(item = pttype, pos = (4, 1))
631 boxSizer.Add(item = gridSizer)
632 boxMainSizer.Add(item = boxSizer, flag = wx.ALL, border = 3)
634 sizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
639 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
640 label =
" %s " % _(
"Axis settings"))
641 boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
643 middleSizer = wx.BoxSizer(wx.HORIZONTAL)
646 for axis, atype
in [(_(
"X-Axis"),
'x-axis'),
647 (_(
"Y-Axis"),
'y-axis')]:
648 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
649 label =
" %s " % axis)
650 boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
651 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
656 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Scale"))
657 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
658 type = wx.Choice(parent = self, id = wx.ID_ANY,
659 size = (100, -1), choices = self.
axislist)
660 type.SetStringSelection(prop[
'type'])
661 type.SetToolTipString(_(
"Automatic axis scaling, custom max and min, or scale matches data range (min)" ))
662 self.
wxId[atype][
'type'] = type.GetId()
663 gridSizer.Add(item = type, pos = (row, 1))
666 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Custom min"))
667 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
668 min = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (70, -1))
669 min.SetValue(str(prop[
'min']))
670 self.
wxId[atype][
'min'] = min.GetId()
671 gridSizer.Add(item = min, pos = (row, 1))
674 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Custom max"))
675 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
676 max = wx.TextCtrl(parent = self, id = wx.ID_ANY, value =
"", size = (70, -1))
677 max.SetValue(str(prop[
'max']))
678 self.
wxId[atype][
'max'] = max.GetId()
679 gridSizer.Add(item = max, pos = (row, 1))
682 log = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _(
"Log scale"))
683 log.SetValue(prop[
'log'])
684 self.
wxId[atype][
'log'] = log.GetId()
685 gridSizer.Add(item = log, pos = (row, 0), span = (1, 2))
688 flag = wx.ALL | wx.EXPAND
690 flag = wx.TOP | wx.BOTTOM | wx.RIGHT | wx.EXPAND
692 boxSizer.Add(item = gridSizer, flag = wx.ALL, border = 3)
693 boxMainSizer.Add(item = boxSizer, flag = flag, border = 3)
697 middleSizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
702 self.
wxId[
'grid'] = {}
703 self.
wxId[
'legend'] = {}
704 self.
wxId[
'font'] = {}
705 box = wx.StaticBox(parent = self, id = wx.ID_ANY,
706 label =
" %s " % _(
"Grid and Legend settings"))
707 boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
708 gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
711 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Grid color"))
712 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
713 gridcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.
properties[
'grid'][
'color'])
714 self.
wxId[
'grid'][
'color'] = gridcolor.GetId()
715 gridSizer.Add(item = gridcolor, pos = (row, 1))
718 gridshow = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _(
"Show grid"))
719 gridshow.SetValue(self.
properties[
'grid'][
'enabled'])
720 self.
wxId[
'grid'][
'enabled'] = gridshow.GetId()
721 gridSizer.Add(item = gridshow, pos = (row, 0), span = (1, 2))
724 label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _(
"Legend font size"))
725 gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
726 legendfontsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value =
"",
727 size = (50, -1), style = wx.SP_ARROW_KEYS)
728 legendfontsize.SetRange(5,100)
729 legendfontsize.SetValue(int(self.
properties[
'font'][
'prop'][
'legendSize']))
730 self.
wxId[
'font'][
'legendSize'] = legendfontsize.GetId()
731 gridSizer.Add(item = legendfontsize, pos = (row, 1))
734 legendshow = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _(
"Show legend"))
735 legendshow.SetValue(self.
properties[
'legend'][
'enabled'])
736 self.
wxId[
'legend'][
'enabled'] = legendshow.GetId()
737 gridSizer.Add(item = legendshow, pos = (row, 0), span = (1, 2))
739 boxMainSizer.Add(item = gridSizer, flag = flag, border = 3)
741 middleSizer.Add(item = boxMainSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
743 sizer.Add(item = middleSizer, flag = wx.ALL, border = 0)
748 line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
749 sizer.Add(item = line, proportion = 0,
750 flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
755 btnSave = wx.Button(self, wx.ID_SAVE)
756 btnApply = wx.Button(self, wx.ID_APPLY)
757 btnOk = wx.Button(self, wx.ID_OK)
758 btnCancel = wx.Button(self, wx.ID_CANCEL)
762 btnApply.SetToolTipString(_(
"Apply changes for the current session"))
763 btnOk.SetToolTipString(_(
"Apply changes for the current session and close dialog"))
764 btnSave.SetToolTipString(_(
"Apply and save changes to user settings file (default for next sessions)"))
765 btnCancel.SetToolTipString(_(
"Close dialog and ignore changes"))
768 btnStdSizer = wx.StdDialogButtonSizer()
769 btnStdSizer.AddButton(btnOk)
770 btnStdSizer.AddButton(btnApply)
771 btnStdSizer.AddButton(btnCancel)
772 btnStdSizer.Realize()
774 btnSizer = wx.BoxSizer(wx.HORIZONTAL)
775 btnSizer.Add(item = btnSave, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
776 btnSizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
777 sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
782 self.mapchoice.Bind(wx.EVT_CHOICE, self.
OnSetMap)
785 btnApply.Bind(wx.EVT_BUTTON, self.
OnApply)
786 btnOk.Bind(wx.EVT_BUTTON, self.
OnOk)
788 btnSave.Bind(wx.EVT_BUTTON, self.
OnSave)
789 btnCancel.Bind(wx.EVT_BUTTON, self.
OnCancel)
795 """!Handler for changing map selection"""
796 idx = event.GetSelection()
800 self.FindWindowById(self.
wxId[
'pcolor']).SetColour(self.
raster[self.
map][
'pcolor'])
803 self.FindWindowById(self.
wxId[
'pstyle']).SetStringSelection(self.
raster[self.
map][
'pstyle'])
808 """!Handler for changing any other option"""
809 self.
map = self.
rasterList[self.mapchoice.GetCurrentSelection()]
811 self.parent.SetGraphStyle()
812 p = self.parent.CreatePlotList()
813 self.parent.DrawPlot(p)
816 """!Apply settings to each map and to entire plot"""
817 self.
raster[self.
map][
'pcolor'] = self.FindWindowById(self.
wxId[
'pcolor']).GetColour()
824 self.
raster[self.
map][
'pstyle'] = self.FindWindowById(self.
wxId[
'pstyle']).GetStringSelection()
828 for axis
in (
'x-axis',
'y-axis'):
829 self.
properties[axis][
'prop'][
'type'] = self.FindWindowById(self.
wxId[axis][
'type']).GetStringSelection()
832 self.
properties[axis][
'prop'][
'log'] = self.FindWindowById(self.
wxId[axis][
'log']).IsChecked()
835 self.
properties[
'marker'][
'color'] = self.FindWindowById(self.
wxId[
'marker'][
'color']).GetColour()
836 self.
properties[
'marker'][
'fill'] = self.FindWindowById(self.
wxId[
'marker'][
'fill']).GetStringSelection()
838 self.
properties[
'marker'][
'type'] = self.FindWindowById(self.
wxId[
'marker'][
'type']).GetStringSelection()
841 self.
properties[
'grid'][
'color'] = self.FindWindowById(self.
wxId[
'grid'][
'color']).GetColour()
842 self.
properties[
'grid'][
'enabled'] = self.FindWindowById(self.
wxId[
'grid'][
'enabled']).IsChecked()
846 self.
properties[
'font'][
'prop'][
'legendSize'] = self.FindWindowById(self.
wxId[
'font'][
'legendSize']).
GetValue()
847 self.
properties[
'legend'][
'enabled'] = self.FindWindowById(self.
wxId[
'legend'][
'enabled']).IsChecked()
850 """!Button 'Save' pressed"""
853 UserSettings.ReadSettingsFile(settings = fileSettings)
855 UserSettings.SaveToFile(fileSettings)
856 self.parent.parent.GetLayerManager().goutput.WriteLog(_(
'Plot settings saved to file \'%s\'.') % UserSettings.filePath)
860 """!Button 'Apply' pressed. Does not close dialog"""
862 self.parent.SetGraphStyle()
863 p = self.parent.CreatePlotList()
864 self.parent.DrawPlot(p)
867 """!Button 'OK' pressed"""
869 self.EndModal(wx.ID_OK)
872 """!Button 'Cancel' pressed"""
def OnOk(self, event)
Button 'OK' pressed.
def OnCancel(self, event)
Button 'Cancel' pressed.
def OnSave(self, event)
Button 'Save' pressed.
def OnCancel(self, event)
Button 'Cancel' pressed.
def OnCopy(self, event)
Copy the regression stats to the clipboard.
def _do_layout(self)
Options dialog layout.
def __init__(self, parent, id=wx.ID_ANY, title=_("Select raster maps to profile"), style=wx.DEFAULT_DIALOG_STYLE, kwargs)
Dialog to select raster maps to profile.
def OnSetOpt(self, event)
Handler for changing any other option.
def __init__(self, parent, id, title, plottype='', style=wx.DEFAULT_DIALOG_STYLE, kwargs)
Dialog to set various options for data plotted, including: line width, color, style; marker size...
Custom control that selects elements.
def split(s)
Platform spefic shlex.split.
def __init__(self, parent, id, message='', title='', style=wx.DEFAULT_FRAME_STYLE, kwargs)
Dialog to display and save statistics for plots.
def OnYLabel(self, event)
def UpdateSettings(self)
Apply settings to each map and to entire plot.
def OnSetMap(self, event)
Handler for changing map selection.
def OnApply(self, event)
Button 'Apply' pressed.
def OnSave(self, event)
Button 'Save' pressed.
def OnClose(self, event)
Button 'Close' pressed.
def OnApply(self, event)
Button 'Apply' pressed.
def OnSelection(self, event)
Choose maps to profile.
def OnXLabel(self, event)
def _do_layout(self)
Do layout.
def OnOk(self, event)
Button 'OK' pressed.