source: sasview/fittingview/src/sans/perspectives/fitting/fitpanel.py @ e7281fd

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since e7281fd was dafc36f, checked in by Jae Cho <jhjcho@…>, 13 years ago

minor changes for better flow

  • Property mode set to 100644
File size: 22.1 KB
RevLine 
[e2f1023]1
2import numpy
3import string 
[d89f09b]4import wx
[f22e626]5import sys
[1b1bbf9]6#from wx.lib.flatnotebook import FlatNotebook as nb
7from wx.aui import AuiNotebook as nb
[a93f525]8
[340c2b3]9from sans.guiframe.panel_base import PanelBase
[3cd5806]10from sans.guiframe.events import PanelOnFocusEvent
[6bbeacd4]11from sans.guiframe.events import StatusEvent
[aefc09f]12from sans.guiframe.dataFitting import check_data_validity
[66ff250]13
[cfc0913]14import basepage
[6bbeacd4]15import models
[330573d]16_BOX_WIDTH = 80
17
18
[1b1bbf9]19class FitPanel(nb, PanelBase):   
[925a30e]20
[d89f09b]21    """
[5062bbf]22    FitPanel class contains fields allowing to fit  models and  data
23   
24    :note: For Fit to be performed the user should check at least one parameter
[d89f09b]25        on fit Panel window.
26       
27    """
28    ## Internal name for the AUI manager
29    window_name = "Fit panel"
30    ## Title to appear on top of the window
31    window_caption = "Fit Panel "
[2139c3f]32    CENTER_PANE = True
[7437880]33   
[6bbeacd4]34    def __init__(self, parent, manager=None, *args, **kwargs):
[5062bbf]35        """
36        """
[1b1bbf9]37        nb.__init__(self, parent, -1,
[3244cbe1]38                    style= wx.aui.AUI_NB_WINDOWLIST_BUTTON|
39                    wx.aui.AUI_NB_DEFAULT_STYLE|
40                    wx.CLIP_CHILDREN)
[3cd5806]41        PanelBase.__init__(self, parent)
[1b1bbf9]42        #self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS)
[6bbeacd4]43        self._manager = manager
[340c2b3]44        self.parent = parent
45        self.event_owner = None
[d89f09b]46        #dictionary of miodel {model class name, model class}
[6bbeacd4]47        self.menu_mng = models.ModelManager()
[b2d9826]48        self.model_list_box = self.menu_mng.get_model_list()
[1b1bbf9]49        #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING
[f22e626]50        self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE
[1b1bbf9]51       
[f22e626]52        self.Bind(self.pageClosedEvent, self.on_close_page)
[6bbeacd4]53         ## save the title of the last page tab added
[2f189dc]54        self.fit_page_name = {}
[cfc0913]55        ## list of existing fit page
[2f189dc]56        self.opened_pages = {}
[aefc09f]57        #index of fit page
[cc31608]58        self.fit_page_index = 0
59        #index of batch page
60        self.batch_page_index = 0
[2f189dc]61        #page of simultaneous fit
[ffa69b6]62        self.sim_page = None
[66ff250]63        self.fit_engine_type = "scipy"
[cfc0913]64        ## get the state of a page
65        self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate)
[330573d]66        self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo)
[fe496eeb]67        self.Bind(basepage.EVT_NEXT_STATE, self._onRedo)
[90a7bbd]68        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing)
[f22e626]69        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_closed)
[1b1bbf9]70
[f22e626]71    def on_closed(self, event):
72        """
73        """
[394ffa7]74        if self.GetPageCount() == 0:
75            self.add_empty_page()
76            self.enable_close_button()
[f22e626]77       
[4e78f56]78    def save_project(self, doc=None):
79        """
80        return an xml node containing state of the panel
81         that guiframe can write to file
82        """
[72bd8e7]83        msg = ""
[4e78f56]84        for uid, page in self.opened_pages.iteritems():
[72bd8e7]85            if page.batch_on:
86                pos = self.GetPageIndex(page)
87                if pos != -1 and page != self.sim_page:
88                    msg += "%s .\n" % str(self.GetPageText(pos))
89            else:
90                data = page.get_data()
91                # state must be cloned
92                state = page.get_state().clone()
93                if data is not None:
94                    new_doc = self._manager.state_reader.write_toXML(data, state)
95                    if doc != None and hasattr(doc, "firstChild"):
96                        child = new_doc.firstChild.firstChild
97                        doc.firstChild.appendChild(child) 
98                    else:
99                        doc = new_doc
100        if msg.strip() != "":
101            temp = "Save Project is not supported for Batch page.\n"
102            temp += "The following pages will not be save:\n"
103            message = temp + msg
104            wx.PostEvent(self._manager.parent, StatusEvent(status=message,
105                                                            info="warning"))
[4e78f56]106        return doc   
[6bbeacd4]107   
[66ff250]108    def _on_engine_change(self, name='scipy'):
109        """
110        """
111        for panel in self.opened_pages.values():
112            self.set_engine_helper(panel=panel, name=name)
113           
114    def set_engine_helper(self, panel, name='scipy'):
115        """
116        """
117        self.fit_engine_type = name
118        if panel != self.sim_page:
119            panel._on_engine_change(name=self.fit_engine_type)
120               
[b2d9826]121    def update_model_list(self):
122        """
123        """
[9466f2d6]124        temp = self.menu_mng.update()
125        if len(temp):
126            self.model_list_box = temp
127        return temp
[aefc09f]128
[66ff250]129    def get_page_by_id(self, uid): 
[6bbeacd4]130        """
131        """
[66ff250]132        if uid not in self.opened_pages:
133            msg = "Fitpanel cannot find ID: %s in self.opened_pages" % str(uid)
[6bbeacd4]134            raise ValueError, msg
135        else:
[66ff250]136            return self.opened_pages[uid]
[31b0c47]137       
[90a7bbd]138    def on_page_changing(self, event):
[6bbeacd4]139        """
[f22e626]140        calls the function when the current event handler has exited. avoiding
141        to call panel on focus on a panel that is currently deleted
142        """
143        wx.CallAfter(self.helper_on_page_change)
144       
145       
146    def helper_on_page_change(self):
147        """
[6bbeacd4]148        """
[90a7bbd]149        pos = self.GetSelection()
150        if pos != -1:
151            selected_page = self.GetPage(pos)
152            wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page))
[e4c9030]153        self.enable_close_button()
[f22e626]154       
[3cd5806]155    def on_set_focus(self, event):
156        """
157        """
158        pos = self.GetSelection()
[90a7bbd]159        if pos != -1:
160            selected_page = self.GetPage(pos)
161            wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page))
[3cd5806]162       
[c8deee5]163    def get_data(self):
164        """
165        get the data in the current page
166        """
167        pos = self.GetSelection()
[90a7bbd]168        if pos != -1:
169            selected_page = self.GetPage(pos)
170            return selected_page.get_data()
[c8deee5]171   
[e88ebfd]172    def set_model_state(state):
173        """
174        receive a state to reset the model in the current page
175        """
176        pos = self.GetSelection()
177        if pos != -1:
178            selected_page = self.GetPage(pos)
179            selected_page.set_model_state(state)
180           
[c8deee5]181    def get_state(self):
182        """
183         return the state of the current selected page
184        """
185        pos = self.GetSelection()
[90a7bbd]186        if pos != -1:
187            selected_page = self.GetPage(pos)
188            return selected_page.get_state()
[c8deee5]189   
[f22e626]190 
[6bbeacd4]191 
[ac2dc0e]192    def close_all(self):
193        """
[8897d66]194        remove all pages, used when a svs file is opened
195        """
[90a7bbd]196       
[8897d66]197        #get number of pages
198        nop = self.GetPageCount()
199        #use while-loop, for-loop will not do the job well.
200        while (nop>0):
201            #delete the first page until no page exists
202            page = self.GetPage(0)
[90a7bbd]203            if self._manager.parent.panel_on_focus == page:
204                self._manager.parent.panel_on_focus = None
[8897d66]205            self._close_helper(selected_page=page)
206            self.DeletePage(0)
207            nop = nop - 1
[90a7bbd]208           
[ac2dc0e]209        ## save the title of the last page tab added
210        self.fit_page_name = {}
211        ## list of existing fit page
212        self.opened_pages = {} 
213         
[05efe88]214       
[31b0c47]215    def set_state(self, state):
216        """
[5062bbf]217        Restore state of the panel
[31b0c47]218        """
219        page_is_opened = False
220        if state is not None:
[66ff250]221            for uid, panel in self.opened_pages.iteritems():
[31b0c47]222                #Don't return any panel is the exact same page is created
[4bee68d]223                if uid == panel.uid and panel.data == state.data:
[31b0c47]224                    # the page is still opened
225                    panel.reset_page(state=state)
[645f9b6]226                    panel.save_current_state() 
[31b0c47]227                    page_is_opened = True
228            if not page_is_opened:
[ea8283d]229                if state.data.__class__.__name__ != 'list':
230                    #To support older state file format
231                    list_data = [state.data]
232                else:
233                    #Todo: need new file format for the list
234                    list_data = state.data
235                panel = self._manager.add_fit_page(data=list_data)
[31b0c47]236                # add data associated to the page created
237                if panel is not None: 
[4bee68d]238                    self._manager.store_data(uid=panel.uid, 
[ea8283d]239                                             data_list=list_data,
[4bee68d]240                                             caption=panel.window_caption)
[31b0c47]241                    panel.reset_page(state=state)
[645f9b6]242                    panel.save_current_state()
[31b0c47]243                   
[90a7bbd]244    def clear_panel(self):
[9b18735]245        """
246        Clear and close all panels, used by guimanager
247        """
[90a7bbd]248       
249        #close all panels only when svs file opened
250        self.close_all()
251        self._manager.mypanels = []
252       
[9b18735]253                       
[ac2dc0e]254    def on_close_page(self, event=None):
[51d47b5]255        """
[5062bbf]256        close page and remove all references to the closed page
[51d47b5]257        """
[d361b462]258        nbr_page = self.GetPageCount()
[51d47b5]259        selected_page = self.GetPage(self.GetSelection())
[f22e626]260        if nbr_page == 1:
261            if selected_page.get_data() == None:
262                if event is not None:
263                    event.Veto()
264                return 
[2f189dc]265        self._close_helper(selected_page=selected_page)
[9853ad0]266       
[2f189dc]267    def close_page_with_data(self, deleted_data):
268        """
[5062bbf]269        close a fit page when its data is completely remove from the graph
[2f189dc]270        """
[784e2fa]271        if deleted_data is None:
272            return
[2f189dc]273        for index in range(self.GetPageCount()):
274            selected_page = self.GetPage(index) 
275            if hasattr(selected_page,"get_data"):
276                data = selected_page.get_data()
[ac2dc0e]277               
[784e2fa]278                if data is None:
279                    #the fitpanel exists and only the initial fit page is open
280                    #with no selected data
281                    return
[f22e626]282                if data.id == deleted_data.id:
[2f189dc]283                    self._close_helper(selected_page)
284                    self.DeletePage(index)
285                    break
[d89f09b]286       
287    def set_manager(self, manager):
288        """
[5062bbf]289        set panel manager
290       
291        :param manager: instance of plugin fitting
292       
[d89f09b]293        """
[c8deee5]294        self._manager = manager
[3cd5806]295        for pos in range(self.GetPageCount()):
296            page = self.GetPage(pos)
297            if page is not None:
298                page.set_manager(self._manager)
[a93f525]299
[ffa69b6]300    def set_model_list(self, dict):
[c77d859]301         """
[5062bbf]302         copy a dictionary of model into its own dictionary
303         
304         :param dict: dictionnary made of model name as key and model class
[c77d859]305             as value
306         """
307         self.model_list_box = dict
[51d47b5]308       
[c77d859]309    def get_current_page(self):
310        """
[5062bbf]311        :return: the current page selected
312       
[c77d859]313        """
[6bbeacd4]314        return self.GetPage(self.GetSelection())
[c77d859]315   
[51d47b5]316    def add_sim_page(self):
[925a30e]317        """
[5062bbf]318        Add the simultaneous fit page
[925a30e]319        """
[51d47b5]320        from simfitpage import SimultaneousFitPage
[c8deee5]321        page_finder= self._manager.get_page_finder()
[b28717b]322        self.sim_page = SimultaneousFitPage(self,page_finder=page_finder, id=-1)
[66ff250]323        self.sim_page.uid = wx.NewId()
[6bbeacd4]324        self.AddPage(self.sim_page,"Simultaneous Fit", True)
[c8deee5]325        self.sim_page.set_manager(self._manager)
[f22e626]326        self.enable_close_button()
[51d47b5]327        return self.sim_page
[d89f09b]328       
[6bbeacd4]329 
[2f189dc]330    def add_empty_page(self):
[9853ad0]331        """
[5062bbf]332        add an empty page
[9853ad0]333        """
[3f36675]334        """
[cc31608]335        if self.batch_on:
336            from batchfitpage import BatchFitPage
337            panel = BatchFitPage(parent=self)
338            #Increment index of batch page
339            self.batch_page_index += 1
340            index = self.batch_page_index
341        else:
[3f36675]342        """
343        from fitpage import FitPage
344        panel = FitPage(parent=self)
[aefc09f]345        if self.batch_on:
346            self.batch_page_index += 1
[55bb249c]347            caption = "BatchPage" + str(self.batch_page_index)
[aefc09f]348            panel.set_index_model(self.batch_page_index)
349        else:
350            #Increment index of fit page
351            self.fit_page_index += 1
[55bb249c]352            caption = "FitPage" + str(self.fit_page_index)
[aefc09f]353            panel.set_index_model(self.fit_page_index)
[22ce7e2]354        panel.batch_on = self.batch_on
[61523e2]355        panel._set_save_flag(not panel.batch_on)
[6bbeacd4]356        panel.populate_box(dict=self.model_list_box)
[c8deee5]357        panel.set_manager(self._manager)
[aefc09f]358        panel.window_caption = caption
359        panel.window_name = caption
[ae4ade7]360        self.AddPage(panel, caption, select=True)
[66ff250]361        self.opened_pages[panel.uid] = panel
362        self.set_engine_helper(panel=panel)
[aefc09f]363        self._manager.create_fit_problem(panel.uid)
364        self._manager.page_finder[panel.uid].add_data(panel.get_data())
[f22e626]365        self.enable_close_button()
[dafc36f]366        panel.on_set_focus(None)
[2f189dc]367        return panel
368   
[f22e626]369    def enable_close_button(self):
370        """
371        display the close button on tab for more than 1 tabs else remove the
372        close button
373        """
374        if self.GetPageCount() <= 1:
375            style = self.GetWindowStyleFlag() 
[3f36675]376            flag = wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
377            if style & wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB == flag:
[f22e626]378                style = style & ~wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
379                self.SetWindowStyle(style)
380        else:
381            style = self.GetWindowStyleFlag()
[3f36675]382            flag = wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
383            if style & wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB != flag:
[f22e626]384                style |= wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
385                self.SetWindowStyle(style)
386           
[8ee56a9]387    def delete_data(self, data):
388        """
389        Delete the given data
390        """
[f22e626]391        if data.__class__.__name__ != "list":
392            raise ValueError, "Fitpanel delete_data expect list of id"
393        else:
394            n = self.GetPageCount()
395            for page in self.opened_pages.values():
396                pos = self.GetPageIndex(page)
397                temp_data = page.get_data()
398                #stop the fitting before deleting the page
399                page.is_fitting()
400                if temp_data is not None and temp_data.id in data:
401                    self.SetSelection(pos)
402                    self.on_close_page(event=None)
403                    temp = self.GetSelection()
404                    self.DeletePage(temp)
405            if self.GetPageCount()== 0:
[e4c9030]406                self._manager.on_add_new_page(event=None)
[f22e626]407       
[3f36675]408    def set_data_on_batch_mode(self, data_list):
409        """
410        Add all data to a single tab when the application is on Batch mode.
411        However all data in the set of data must be either 1D or 2D type.
412        This method presents option to select the data type before creating a
413        tab.
414        """
415        data_1d_list = []
416        data_2d_list = []
[2e643a8]417        group_id_1d = wx.NewId()
[4225aed]418        # separate data into data1d and data2d list
[3f36675]419        for data in data_list:
420            if data.__class__.__name__ == "Data1D":
[2e643a8]421                data.group_id = group_id_1d
[3f36675]422                data_1d_list.append(data)
423            if data.__class__.__name__ == "Data2D":
[017e0390]424                data.group_id = wx.NewId()
[3f36675]425                data_2d_list.append(data)
426        page = None
427        for p in self.opened_pages.values():
[aefc09f]428            #check if there is an empty page to fill up
[dafc36f]429            if not check_data_validity(p.get_data()) and p.batch_on:
[3f36675]430                page = p
[dafc36f]431                #self.batch_page_index += 1
[3f36675]432                break
433        if data_1d_list and data_2d_list:
434            # need to warning the user that this batch is a special case
435            from .fitting_widgets import BatchDataDialog
436            dlg = BatchDataDialog(self)
437            if dlg.ShowModal() == wx.ID_OK:
438                data_type = dlg.get_data()
439                dlg.Destroy()
440                if page  is None:
441                    page = self.add_empty_page()
442                if data_type == 1:
443                    #user has selected only data1D
444                    page.fill_data_combobox(data_1d_list)
445                elif data_type == 2:
446                    page.fill_data_combobox(data_2d_list)
447            else:
448                #the batch analysis is canceled
449                 dlg.Destroy()
450                 return None
451        else:
452            if page is None:
453                page = self.add_empty_page()
454            if data_1d_list and not data_2d_list:
455                #only on type of data
456                page.fill_data_combobox(data_1d_list)
457            elif not data_1d_list and data_2d_list:
458                page.fill_data_combobox(data_2d_list)
[72bd8e7]459               
[aefc09f]460        pos = self.GetPageIndex(page)
461        caption = "BatchPage" + str(self.batch_page_index)
462        self.SetPageText(pos, caption)
[05efe88]463        page.batch_on = self.batch_on
[61523e2]464        page._set_save_flag(not page.batch_on)
[aefc09f]465        page.window_caption = caption
466        page.window_name = caption
[72bd8e7]467        self.SetSelection(pos)
[3f36675]468        self.opened_pages[page.uid] = page
469        return page
470   
[cc31608]471    def set_data(self, data_list):
[2f189dc]472        """
[5062bbf]473        Add a fitting page on the notebook contained by fitpanel
474       
475        :param data: data to fit
476       
[3f36675]477        :return panel : page just added for further used.
478        is used by fitting module
[5062bbf]479       
[2f189dc]480        """
[cc31608]481        if not data_list:
[2f189dc]482            return None
[cc31608]483        if self.batch_on:
[3f36675]484           return self.set_data_on_batch_mode(data_list)
[cc31608]485        else:
486            data = None
[7f76f89]487            try:
488                data = data_list[0]
489            except:
490                # for 'fitv' files
491                data_list = [data]
492                data = data_list[0]
493               
[cc31608]494            if data is None:
495                return None
[6bbeacd4]496        for page in self.opened_pages.values():
497            #check if the selected data existing in the fitpanel
498            pos = self.GetPageIndex(page)
[dafc36f]499            if not check_data_validity(page.get_data()) and not page.batch_on:
[cc31608]500                #make sure data get placed in 1D empty tab if data is 1D
501                #else data get place on 2D tab empty tab
[a5701e6]502                enable2D = page.get_view_mode()
503                if (data.__class__.__name__ == "Data2D" and enable2D)\
504                or (data.__class__.__name__ == "Data1D" and not enable2D):
[05efe88]505                    page.batch_on = self.batch_on
[61523e2]506                    page._set_save_flag(not page.batch_on)
[cc31608]507                    page.fill_data_combobox(data_list)
[dafc36f]508                    #caption = "FitPage" + str(self.fit_page_index)
509                    self.SetPageText(pos, page.window_caption)
[cc31608]510                    self.SetSelection(pos)
511                    return page
[aefc09f]512        #create new page and add data
[6bbeacd4]513        page = self.add_empty_page()
[9f391af]514        pos = self.GetPageIndex(page)
[cc31608]515        page.fill_data_combobox(data_list)
[66ff250]516        self.opened_pages[page.uid] = page
[09ef5a60]517        self.SetSelection(pos)
[6bbeacd4]518        return page
519       
520    def _onGetstate(self, event):
[cfc0913]521        """
[5062bbf]522        copy the state of a page
[cfc0913]523        """
[6bbeacd4]524        page = event.page
[66ff250]525        if page.uid in self.fit_page_name:
526           self.fit_page_name[page.uid].appendItem(page.createMemento()) 
[cfc0913]527           
[4e78f56]528    def _onUndo(self, event):
[330573d]529        """
[5062bbf]530        return the previous state of a given page is available
[330573d]531        """
532        page = event.page
[66ff250]533        if page.uid in self.fit_page_name:
534            if self.fit_page_name[page.uid].getCurrentPosition()==0:
[330573d]535                state = None
536            else:
[66ff250]537                state = self.fit_page_name[page.uid].getPreviousItem()
[fe496eeb]538                page._redo.Enable(True)
[330573d]539            page.reset_page(state)
[fe496eeb]540       
[2f189dc]541    def _onRedo(self, event): 
[fe496eeb]542        """
[5062bbf]543        return the next state available
[fe496eeb]544        """       
545        page = event.page
[66ff250]546        if page.uid in self.fit_page_name:
547            length= len(self.fit_page_name[page.uid])
548            if self.fit_page_name[page.uid].getCurrentPosition()== length -1:
[fe496eeb]549                state = None
550                page._redo.Enable(False)
[3b9e023]551                page._redo.Enable(True)
[fe496eeb]552            else:
[66ff250]553                state =self.fit_page_name[page.uid].getNextItem()
[fe496eeb]554            page.reset_page(state) 
[2f189dc]555                 
556    def _close_helper(self, selected_page):
[3f1af74]557        """
[5062bbf]558        Delete the given page from the notebook
[3f1af74]559        """
[2f189dc]560        #remove hint page
[1b1bbf9]561        #if selected_page == self.hint_page:
562        #    return
[2f189dc]563        ## removing sim_page
564        if selected_page == self.sim_page :
[c8deee5]565            self._manager.sim_page=None 
[2f189dc]566            return
[5e48acb]567        """
568        # The below is not working when delete #5 and still have #6.
[cc31608]569        if selected_page.__class__.__name__ == "FitPage":
570            self.fit_page_index -= 1
571        else:
572            self.batch_page_index -= 1
[5e48acb]573        """
[2f189dc]574        ## closing other pages
575        state = selected_page.createMemento()
576        page_name = selected_page.window_name
[c8deee5]577        page_finder = self._manager.get_page_finder() 
[2f189dc]578        fitproblem = None
579        ## removing fit page
[c6036f5]580        data = selected_page.get_data()
581        #Don' t remove plot for 2D
582        flag = True
583        if data.__class__.__name__ == 'Data2D':
584            flag = False
[2f189dc]585        if selected_page in page_finder:
586            #Delete the name of the page into the list of open page
[66ff250]587            for uid, list in self.opened_pages.iteritems():
[2f189dc]588                #Don't return any panel is the exact same page is created
[6bbeacd4]589               
[66ff250]590                if flag and selected_page.uid == uid:
591                    self._manager.remove_plot(uid, theory=False)
[2f189dc]592                    break 
593            del page_finder[selected_page]
594        ##remove the check box link to the model name of this page (selected_page)
595        try:
596            self.sim_page.draw_page()
597        except:
598            ## that page is already deleted no need to remove check box on
599            ##non existing page
600            pass
601               
602        #Delete the name of the page into the list of open page
[66ff250]603        for uid, list in self.opened_pages.iteritems():
[2f189dc]604            #Don't return any panel is the exact same page is created
[66ff250]605            if selected_page.uid == uid:
606                del self.opened_pages[selected_page.uid]
[2f189dc]607                break 
[5e48acb]608     
Note: See TracBrowser for help on using the repository browser.