~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to gui/wxpython/iscatt/dialogs.py

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
@package iscatt.dialogs
 
3
 
 
4
@brief Dialogs widgets.
 
5
 
 
6
Classes:
 
7
 - dialogs::AddScattPlotDialog
 
8
 - dialogs::ExportCategoryRaster
 
9
 - dialogs::SettingsDialog
 
10
 - dialogs::ManageBusyCursorMixin
 
11
 - dialogs::RenameClassDialog
 
12
 
 
13
(C) 2013 by the GRASS Development Team
 
14
 
 
15
This program is free software under the GNU General Public License
 
16
(>=v2). Read the file COPYING that comes with GRASS for details.
 
17
 
 
18
@author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
 
19
"""
 
20
import os
 
21
import sys
 
22
 
 
23
import wx
 
24
from iscatt.iscatt_core import idBandsToidScatt
 
25
from gui_core.gselect import Select
 
26
import wx.lib.colourselect as csel
 
27
 
 
28
import grass.script as grass
 
29
 
 
30
from core import globalvar
 
31
from core.gcmd import GMessage
 
32
from core.settings import UserSettings
 
33
from gui_core.dialogs import SimpleDialog
 
34
 
 
35
class AddScattPlotDialog(wx.Dialog):
 
36
 
 
37
    def __init__(self, parent, bands, check_bands_callback, id  = wx.ID_ANY):
 
38
        wx.Dialog.__init__(self, parent, title = _("Add scatter plots"), id = id)
 
39
 
 
40
        self.bands = bands
 
41
 
 
42
        self.x_band = None
 
43
        self.y_band = None
 
44
 
 
45
        self.chb_callback = check_bands_callback
 
46
 
 
47
        self.added_bands_ids = []
 
48
        self.sel_bands_ids = []
 
49
        self._createWidgets()
 
50
 
 
51
    def _createWidgets(self):
 
52
 
 
53
        self.labels = {}
 
54
        self.params = {}
 
55
 
 
56
        self.band_1_label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("x axis:"))
 
57
 
 
58
        self.band_1_ch = wx.ComboBox(parent = self, id = wx.ID_ANY,
 
59
                                     choices = self.bands,
 
60
                                     style = wx.CB_READONLY, size = (350, 30))
 
61
 
 
62
        self.band_2_label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("y axis:"))
 
63
 
 
64
        self.band_2_ch = wx.ComboBox(parent = self, id = wx.ID_ANY,
 
65
                                     choices = self.bands,
 
66
                                     style = wx.CB_READONLY, size = (350, 30))
 
67
 
 
68
        self.scattsBox = wx.ListBox(parent = self,  id = wx.ID_ANY, size = (-1, 150),
 
69
                                    style = wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
 
70
 
 
71
        # buttons
 
72
        self.btn_add = wx.Button(parent=self, id=wx.ID_ADD)
 
73
        self.btn_remove = wx.Button(parent=self, id=wx.ID_REMOVE)
 
74
        
 
75
        self.btn_close = wx.Button(parent=self, id=wx.ID_CANCEL)        
 
76
        self.btn_ok = wx.Button(parent=self, id=wx.ID_OK)
 
77
 
 
78
        self._layout()
 
79
 
 
80
    def _layout(self):
 
81
 
 
82
        border = wx.BoxSizer(wx.VERTICAL) 
 
83
        dialogSizer = wx.BoxSizer(wx.VERTICAL)
 
84
 
 
85
        regionSizer = wx.BoxSizer(wx.HORIZONTAL)
 
86
 
 
87
        dialogSizer.Add(item = self._addSelectSizer(title = self.band_1_label, 
 
88
                                                    sel = self.band_1_ch))
 
89
 
 
90
        dialogSizer.Add(item = self._addSelectSizer(title = self.band_2_label, 
 
91
                                                    sel = self.band_2_ch))
 
92
 
 
93
 
 
94
        dialogSizer.Add(item=self.btn_add, proportion=0,  flag = wx.TOP | wx.ALIGN_RIGHT, border = 5)
 
95
 
 
96
        box = wx.StaticBox(self, id = wx.ID_ANY,
 
97
                           label = " %s " % _("Bands of scatter plots to be added (x y):"))
 
98
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
99
 
 
100
        sizer.Add(item=self.scattsBox, proportion=1, flag=wx.EXPAND | wx.TOP, border=5)
 
101
        sizer.Add(item=self.btn_remove, proportion=0, flag=wx.TOP | wx.ALIGN_RIGHT, border = 5)
 
102
 
 
103
        dialogSizer.Add(item=sizer, proportion=1,  flag = wx.EXPAND | wx.TOP, border = 5)
 
104
 
 
105
        # buttons
 
106
        self.btnsizer = wx.BoxSizer(orient = wx.HORIZONTAL)
 
107
 
 
108
        self.btnsizer.Add(item = self.btn_close, proportion = 0,
 
109
                          flag = wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER,
 
110
                          border = 10)
 
111
        
 
112
        self.btnsizer.Add(item = self.btn_ok, proportion = 0,
 
113
                          flag = wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER,
 
114
                          border = 10)
 
115
 
 
116
        dialogSizer.Add(item = self.btnsizer, proportion = 0,
 
117
                        flag = wx.ALIGN_CENTER | wx.TOP, border = 5)
 
118
 
 
119
        border.Add(item = dialogSizer, proportion = 0,
 
120
                   flag = wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 10)
 
121
 
 
122
        self.SetSizer(border)
 
123
        self.Layout()
 
124
        self.Fit()
 
125
 
 
126
        # bindings
 
127
        self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
 
128
        self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk)
 
129
        self.btn_add.Bind(wx.EVT_BUTTON, self.OnAdd)
 
130
        self.btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveLayer)
 
131
 
 
132
    def OnOk(self, event):
 
133
        
 
134
        if not self.GetBands():
 
135
            GMessage(parent=self, message=_("No scatter plots selected."))
 
136
            return
 
137
 
 
138
        event.Skip()
 
139
 
 
140
    def _addSelectSizer(self, title, sel): 
 
141
        """Helper layout function.
 
142
        """
 
143
        selSizer = wx.BoxSizer(orient = wx.VERTICAL)
 
144
 
 
145
        selTitleSizer = wx.BoxSizer(wx.HORIZONTAL)
 
146
        selTitleSizer.Add(item = title, proportion = 1,
 
147
                          flag = wx.TOP | wx.EXPAND, border = 5)
 
148
 
 
149
        selSizer.Add(item = selTitleSizer, proportion = 0,
 
150
                     flag = wx.EXPAND)
 
151
 
 
152
        selSizer.Add(item = sel, proportion = 1,
 
153
                     flag = wx.EXPAND | wx.TOP| wx.ALIGN_CENTER_VERTICAL,
 
154
                     border = 5)
 
155
 
 
156
        return selSizer
 
157
 
 
158
    def GetBands(self):
 
159
        """Get layers"""
 
160
        return self.sel_bands_ids
 
161
 
 
162
    def OnClose(self, event):
 
163
        """Close dialog
 
164
        """
 
165
        if not self.IsModal():
 
166
            self.Destroy()
 
167
        event.Skip()
 
168
 
 
169
    def OnRemoveLayer(self, event):
 
170
        """Remove layer from listbox"""
 
171
        while self.scattsBox.GetSelections():
 
172
            sel = self.scattsBox.GetSelections()[0]
 
173
            self.scattsBox.Delete(sel)
 
174
            self.sel_bands_ids.pop(sel)
 
175
 
 
176
    def OnAdd(self, event):
 
177
        """
 
178
        """
 
179
        b_x = self.band_1_ch.GetSelection()
 
180
        b_y = self.band_2_ch.GetSelection()
 
181
 
 
182
        if b_x < 0 or b_y < 0:
 
183
            GMessage(parent=self, message=_("Select both x and y bands."))
 
184
            return
 
185
        if b_y == b_x:
 
186
            GMessage(parent=self, message=_("Selected bands must be different."))
 
187
            return
 
188
 
 
189
        if [b_x, b_y] in self.sel_bands_ids or [b_y, b_x] in self.sel_bands_ids:
 
190
            GMessage(parent=self, 
 
191
                     message=_("Scatter plot with same bands combination (regardless x y order) " 
 
192
                               "has been already added into the list."))
 
193
            return
 
194
 
 
195
        if not self.chb_callback(b_x, b_y):
 
196
            return
 
197
 
 
198
        self.sel_bands_ids.append([b_x, b_y])
 
199
 
 
200
        b_x_str = self.band_1_ch.GetStringSelection()
 
201
        b_y_str = self.band_2_ch.GetStringSelection()
 
202
 
 
203
        text = b_x_str + " " + b_y_str
 
204
 
 
205
        self.scattsBox.Append(text)
 
206
        event.Skip()
 
207
 
 
208
class ExportCategoryRaster(wx.Dialog):
 
209
    def __init__(self, parent, title, rasterName = None, id = wx.ID_ANY,
 
210
                 style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
 
211
                 **kwargs):
 
212
        """Dialog for export of category raster.
 
213
        
 
214
        :param parent: window
 
215
        :param str rasterName name of vector layer for export
 
216
        :param title: window title
 
217
        """
 
218
        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
 
219
        
 
220
        self.rasterName = rasterName
 
221
        self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
 
222
        
 
223
        self.btnCancel = wx.Button(parent = self.panel, id = wx.ID_CANCEL)
 
224
        self.btnOK     = wx.Button(parent = self.panel, id = wx.ID_OK)
 
225
        self.btnOK.SetDefault()
 
226
        self.btnOK.Enable(False)
 
227
        self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
 
228
        
 
229
        self.__layout()
 
230
        
 
231
        self.vectorNameCtrl.Bind(wx.EVT_TEXT, self.OnTextChanged)
 
232
        self.OnTextChanged(None)
 
233
        wx.CallAfter(self.vectorNameCtrl.SetFocus)
 
234
 
 
235
    def OnTextChanged(self, event):
 
236
        """Name of new vector map given.
 
237
        
 
238
        Enable/diable OK button.
 
239
        """
 
240
        file = self.vectorNameCtrl.GetValue()
 
241
        if len(file) > 0:
 
242
            self.btnOK.Enable(True)
 
243
        else:
 
244
            self.btnOK.Enable(False)
 
245
        
 
246
    def __layout(self):
 
247
        """Do layout"""
 
248
        sizer = wx.BoxSizer(wx.VERTICAL)
 
249
        
 
250
        dataSizer = wx.BoxSizer(wx.VERTICAL)
 
251
        
 
252
        dataSizer.Add(item = wx.StaticText(parent = self.panel, id = wx.ID_ANY,
 
253
                                           label = _("Enter name of new vector map:")),
 
254
                      proportion = 0, flag = wx.ALL, border = 3)
 
255
        self.vectorNameCtrl = Select(parent = self.panel, type = 'raster',
 
256
                                     mapsets = [grass.gisenv()['MAPSET']],
 
257
                                     size = globalvar.DIALOG_GSELECT_SIZE)
 
258
        if self.rasterName:
 
259
            self.vectorNameCtrl.SetValue(self.rasterName)
 
260
        dataSizer.Add(item = self.vectorNameCtrl,
 
261
                      proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
 
262
        
 
263
                      
 
264
        # buttons
 
265
        btnSizer = wx.StdDialogButtonSizer()
 
266
        btnSizer.AddButton(self.btnCancel)
 
267
        btnSizer.AddButton(self.btnOK)
 
268
        btnSizer.Realize()
 
269
        
 
270
        sizer.Add(item = dataSizer, proportion = 1,
 
271
                       flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
 
272
        
 
273
        sizer.Add(item = btnSizer, proportion = 0,
 
274
                       flag = wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border = 5)
 
275
        
 
276
        self.panel.SetSizer(sizer)
 
277
        sizer.Fit(self)
 
278
        
 
279
        self.SetMinSize(self.GetSize())
 
280
        
 
281
    def GetRasterName(self):
 
282
        """Returns vector name"""
 
283
        return self.vectorNameCtrl.GetValue()
 
284
 
 
285
    def OnOK(self, event):
 
286
        """Checks if map exists and can be overwritten."""
 
287
        overwrite = UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled')
 
288
        rast_name = self.GetRasterName()
 
289
        res = grass.find_file(rast_name, element = 'cell')
 
290
        if res['fullname'] and overwrite is False:
 
291
            qdlg = wx.MessageDialog(parent = self,
 
292
                                        message = _("Raster map <%s> already exists."
 
293
                                                    " Do you want to overwrite it?" % rast_name) ,
 
294
                                        caption = _("Raster <%s> exists" % rast_name),
 
295
                                        style = wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE)
 
296
            if qdlg.ShowModal() == wx.ID_YES:
 
297
                event.Skip()
 
298
            qdlg.Destroy()
 
299
        else:
 
300
            event.Skip()
 
301
 
 
302
class SettingsDialog(wx.Dialog):
 
303
    def __init__(self, parent, id, title, scatt_mgr, pos=wx.DefaultPosition, size=wx.DefaultSize,
 
304
                 style=wx.DEFAULT_DIALOG_STYLE):
 
305
        """Settings dialog"""
 
306
        wx.Dialog.__init__(self, parent, id, title, pos, size, style)
 
307
 
 
308
        self.scatt_mgr = scatt_mgr
 
309
 
 
310
        maxValue = 1e8
 
311
        self.parent = parent
 
312
        self.settings = {}
 
313
 
 
314
        settsLabels = {} 
 
315
 
 
316
        self.settings["show_ellips"] = wx.CheckBox(parent = self, id=wx.ID_ANY,
 
317
                                                   label = _('Show confidence ellipses'))
 
318
        show_ellips = UserSettings.Get(group ='scatt', key = "ellipses", subkey = "show_ellips")
 
319
        self.settings["show_ellips"].SetValue(show_ellips)
 
320
 
 
321
 
 
322
        self.colorsSetts = {
 
323
                            "sel_pol" : ["selection", _("Selection polygon color:")],
 
324
                            "sel_pol_vertex" : ["selection", _("Color of selection polygon vertex:")], 
 
325
                            "sel_area" : ["selection", _("Selected area color:")]
 
326
                           }
 
327
 
 
328
        for settKey, sett in self.colorsSetts.iteritems():
 
329
            settsLabels[settKey] = wx.StaticText(parent = self, id = wx.ID_ANY, label = sett[1])
 
330
            col = UserSettings.Get(group ='scatt', key = sett[0], subkey = settKey)
 
331
            self.settings[settKey] = csel.ColourSelect(parent = self, id = wx.ID_ANY,
 
332
                                            colour = wx.Colour(col[0],
 
333
                                                               col[1],
 
334
                                                               col[2], 
 
335
                                                               255))
 
336
 
 
337
        self.sizeSetts = {
 
338
                          "snap_tresh" : ["selection", _("Snapping treshold in pixels:")],
 
339
                          "sel_area_opacty" : ["selection", _("Selected area opacity:")]
 
340
                         }
 
341
 
 
342
        for settKey, sett in self.sizeSetts.iteritems():
 
343
            settsLabels[settKey] = wx.StaticText(parent = self, id = wx.ID_ANY, label = sett[1])
 
344
            self.settings[settKey] = wx.SpinCtrl(parent = self, id = wx.ID_ANY, min=0, max = 100)
 
345
            size = int(UserSettings.Get(group = 'scatt', key = sett[0], subkey = settKey))
 
346
            self.settings[settKey].SetValue(size)
 
347
 
 
348
 
 
349
        # buttons
 
350
        self.btnSave = wx.Button(self, wx.ID_SAVE)
 
351
        self.btnApply = wx.Button(self, wx.ID_APPLY)
 
352
        self.btnClose = wx.Button(self, wx.ID_CLOSE)
 
353
        self.btnApply.SetDefault()
 
354
 
 
355
        # bindings
 
356
        self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
 
357
        self.btnApply.SetToolTipString(_("Apply changes for the current session"))
 
358
        self.btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
 
359
        self.btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
 
360
        self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
 
361
        self.btnClose.SetToolTipString(_("Close dialog"))
 
362
 
 
363
        #Layout
 
364
 
 
365
        # Analysis result style layout
 
366
        self.SetMinSize(self.GetBestSize())
 
367
 
 
368
        sizer = wx.BoxSizer(wx.VERTICAL)
 
369
 
 
370
        sel_pol_box = wx.StaticBox(parent = self, id = wx.ID_ANY,
 
371
                                   label =" %s " % _("Selection style:"))
 
372
        selPolBoxSizer = wx.StaticBoxSizer(sel_pol_box, wx.VERTICAL)
 
373
 
 
374
        gridSizer = wx.GridBagSizer(vgap = 1, hgap = 1)
 
375
 
 
376
        row = 0
 
377
        setts = dict(self.colorsSetts.items() + self.sizeSetts.items())
 
378
 
 
379
        settsOrder = ["sel_pol", "sel_pol_vertex", "sel_area",
 
380
                      "sel_area_opacty", "snap_tresh"]
 
381
        for settKey in settsOrder:
 
382
            sett = setts[settKey]
 
383
            gridSizer.Add(item = settsLabels[settKey], flag = wx.ALIGN_CENTER_VERTICAL, pos =(row, 0))
 
384
            gridSizer.Add(item = self.settings[settKey],
 
385
                          flag = wx.ALIGN_RIGHT | wx.ALL, border = 5,
 
386
                          pos =(row, 1))  
 
387
            row += 1
 
388
 
 
389
        gridSizer.AddGrowableCol(1)
 
390
        selPolBoxSizer.Add(item = gridSizer, flag = wx.EXPAND)
 
391
 
 
392
        ell_box = wx.StaticBox(parent = self, id = wx.ID_ANY,
 
393
                               label =" %s " % _("Ellipses settings:"))
 
394
        ellPolBoxSizer = wx.StaticBoxSizer(ell_box, wx.VERTICAL)
 
395
        gridSizer = wx.GridBagSizer(vgap = 1, hgap = 1)
 
396
 
 
397
        sett = setts[settKey]
 
398
 
 
399
        row = 0
 
400
        gridSizer.Add(item=self.settings["show_ellips"], 
 
401
                      flag=wx.ALIGN_CENTER_VERTICAL, 
 
402
                      pos=(row, 0))
 
403
 
 
404
        gridSizer.AddGrowableCol(1)
 
405
        ellPolBoxSizer.Add(item=gridSizer, flag=wx.EXPAND)
 
406
 
 
407
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
 
408
        btnSizer.Add(self.btnApply, flag=wx.LEFT | wx.RIGHT, border=5)
 
409
        btnSizer.Add(self.btnSave, flag=wx.LEFT | wx.RIGHT, border=5)
 
410
        btnSizer.Add(self.btnClose, flag=wx.LEFT | wx.RIGHT, border=5)
 
411
 
 
412
        sizer.Add(item=selPolBoxSizer, flag=wx.EXPAND | wx.ALL, border=5)
 
413
        sizer.Add(item=ellPolBoxSizer, flag=wx.EXPAND | wx.ALL, border=5)
 
414
        sizer.Add(item=btnSizer, flag=wx.EXPAND | wx.ALL, border=5, proportion=0)    
 
415
 
 
416
        self.SetSizer(sizer)
 
417
        sizer.Fit(self)
 
418
     
 
419
    def OnSave(self, event):
 
420
        """Button 'Save' pressed"""
 
421
        self.UpdateSettings()
 
422
 
 
423
        fileSettings = {}
 
424
        UserSettings.ReadSettingsFile(settings=fileSettings)
 
425
        fileSettings['scatt'] = UserSettings.Get(group='scatt')
 
426
        UserSettings.SaveToFile(fileSettings)
 
427
 
 
428
        self.Close()
 
429
 
 
430
    def UpdateSettings(self):
 
431
 
 
432
        chanaged_setts = [];
 
433
        for settKey, sett in self.colorsSetts.iteritems():
 
434
            col = tuple(self.settings[settKey].GetColour())
 
435
            col_s = UserSettings.Get(group='scatt', key=sett[0], subkey=settKey)
 
436
            if col_s != col:
 
437
                UserSettings.Set(group='scatt', 
 
438
                                 key=sett[0], 
 
439
                                 subkey=settKey,
 
440
                                 value=col)
 
441
                chanaged_setts.append([settKey, sett[0]])
 
442
 
 
443
        for settKey, sett in self.sizeSetts.iteritems():
 
444
            val = self.settings[settKey].GetValue()
 
445
            val_s = UserSettings.Get(group ='scatt', key = sett[0], subkey = settKey)
 
446
 
 
447
            if val_s != val:
 
448
                UserSettings.Set(group = 'scatt', key = sett[0], subkey = settKey, 
 
449
                                 value = val)
 
450
                chanaged_setts.append([settKey, sett[0]])
 
451
 
 
452
        val = self.settings['show_ellips'].IsChecked()
 
453
        val_s = UserSettings.Get(group ='scatt', key='ellipses', subkey='show_ellips')
 
454
 
 
455
        if val != val_s:
 
456
            UserSettings.Set(group='scatt', key='ellipses', subkey='show_ellips', 
 
457
                             value=val)
 
458
            chanaged_setts.append(['ellipses', 'show_ellips'])
 
459
 
 
460
        if chanaged_setts: 
 
461
            self.scatt_mgr.SettingsUpdated(chanaged_setts)
 
462
 
 
463
    def OnApply(self, event):
 
464
        """Button 'Apply' pressed"""
 
465
        self.UpdateSettings()
 
466
        #self.Close()
 
467
 
 
468
    def OnClose(self, event):
 
469
        """Button 'Cancel' pressed"""
 
470
        self.Close()
 
471
 
 
472
class ManageBusyCursorMixin:
 
473
    def __init__(self, window):
 
474
        self.win = window
 
475
 
 
476
        self.is_busy = False
 
477
        self.cur_inside = False
 
478
 
 
479
        self.win.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
 
480
        self.win.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
 
481
 
 
482
    def OnLeave(self, event):   
 
483
        self.cur_inside = False     
 
484
        self.busy_cur = None
 
485
 
 
486
    def OnEnter(self, event):
 
487
        self.cur_inside = True
 
488
        if self.is_busy:
 
489
            self.busy_cur = wx.BusyCursor()
 
490
 
 
491
    def UpdateCur(self, busy):
 
492
        self.is_busy = busy
 
493
        if self.cur_inside and self.is_busy:
 
494
            self.busy_cur = wx.BusyCursor()
 
495
            return
 
496
 
 
497
        self.busy_cur = None
 
498
 
 
499
class RenameClassDialog(SimpleDialog):
 
500
    def __init__(self, parent, old_name, title=("Change class name")):
 
501
        SimpleDialog.__init__(self, parent, title)
 
502
 
 
503
        self.name = wx.TextCtrl(self.panel, id = wx.ID_ANY) 
 
504
        self.name.SetValue(old_name)
 
505
 
 
506
        self.dataSizer.Add(self.name, proportion = 0,
 
507
                           flag = wx.EXPAND | wx.ALL, border = 1)
 
508
 
 
509
        self.panel.SetSizer(self.sizer)
 
510
        self.name.SetMinSize((200, -1))
 
511
        self.sizer.Fit(self)
 
512
 
 
513
    def GetNewName(self):
 
514
        return self.name.GetValue()