- Timestamp:
- Oct 7, 2016 4:03:49 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 95eef00
- Parents:
- ff3f5821
- Location:
- src/sas/sasgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
r998ca90 re6de6b8 1152 1152 self.delete_panel(ID) 1153 1153 break 1154 self.cpanel_on_focus.SetFocus() 1154 if self.cpanel_on_focus is not None: 1155 self.cpanel_on_focus.SetFocus() 1155 1156 1156 1157 … … 1917 1918 self._default_save_location = os.path.dirname(path) 1918 1919 dlg.Destroy() 1919 1920 # Reset to a base state 1921 self._on_reset_state() 1922 1923 # Load the project file 1924 self.load_state(path=path, is_project=True) 1920 # Reset to a base state 1921 self._on_reset_state() 1922 # Load the project file 1923 self.load_state(path=path, is_project=True) 1925 1924 1926 1925 def _on_reset_state(self): … … 1930 1929 """ 1931 1930 # Reset all plugins to their base state 1931 self._data_panel.set_panel_on_focus() 1932 # Remove all loaded data 1933 self._data_panel.selection_cbox.SetValue('Select all Data') 1934 self._data_panel._on_selection_type(None) 1932 1935 for plugin in self.plugins: 1933 1936 plugin.clear_panel() 1934 1937 # Reset plot number to 0 1935 1938 self.graph_num = 0 1936 # Remove all loaded data1937 self._data_panel.selection_cbox.SetValue('Select all Data')1938 self._data_panel._on_selection_type(None)1939 1939 1940 1940 def _on_save_application(self, event): -
src/sas/sasgui/perspectives/fitting/fitpanel.py
r998ca90 re6de6b8 10 10 11 11 from sas.sasgui.guiframe.panel_base import PanelBase 12 from sas.sasgui.guiframe.events import PanelOnFocusEvent 13 from sas.sasgui.guiframe.events import StatusEvent 12 from sas.sasgui.guiframe.events import PanelOnFocusEvent, StatusEvent 14 13 from sas.sasgui.guiframe.dataFitting import check_data_validity 15 14 from sas.sasgui.perspectives.fitting.simfitpage import SimultaneousFitPage … … 176 175 def get_state(self): 177 176 """ 178 177 return the state of the current selected page 179 178 """ 180 179 pos = self.GetSelection() … … 188 187 """ 189 188 190 # get number of pages189 # get number of pages 191 190 nop = self.GetPageCount() 192 # use while-loop, for-loop will not do the job well.191 # use while-loop, for-loop will not do the job well. 193 192 while (nop > 0): 194 # delete the first page until no page exists193 # delete the first page until no page exists 195 194 page = self.GetPage(0) 196 195 if self._manager.parent.panel_on_focus == page: … … 198 197 self._close_helper(selected_page=page) 199 198 self.DeletePage(0) 200 nop = nop - 1 201 202 # save the title of the last page tab added 199 nop = self.GetPageCount() 200 # Clear list of names 203 201 self.fit_page_name = {} 204 # list of existing fit page202 # Clear list of opened pages 205 203 self.opened_pages = {} 206 204 self.fit_page_index = 0 … … 214 212 if state is not None: 215 213 for uid, panel in self.opened_pages.iteritems(): 216 # Don't return any panel is the exact same page is created214 # Don't return any panel is the exact same page is created 217 215 if uid == panel.uid and panel.data == state.data: 218 216 # the page is still opened … … 222 220 if not page_is_opened: 223 221 if state.data.__class__.__name__ != 'list': 224 # To support older state file format222 # To support older state file format 225 223 list_data = [state.data] 226 224 else: 227 # Todo: need new file format for the list225 # Todo: need new file format for the list 228 226 list_data = state.data 229 227 panel = self._manager.add_fit_page(data=list_data) … … 240 238 Clear and close all panels, used by guimanager 241 239 """ 242 243 #close all panels only when svs file opened 240 # close all panels only when svs file opened 244 241 self.close_all() 245 242 self._manager.mypanels = [] … … 254 251 selected_page = self.GetPage(self.GetSelection()) 255 252 if nbr_page == 1: 256 if selected_page.get_data() ==None:253 if selected_page.get_data() is not None: 257 254 if event is not None: 258 255 event.Veto() … … 272 269 273 270 if data is None: 274 # the fitpanel exists and only the initial fit page is open275 # with no selected data271 # the fitpanel exists and only the initial fit page is open 272 # with no selected data 276 273 return 277 274 if data.id == deleted_data.id: … … 285 282 286 283 :param manager: instance of plugin fitting 287 288 284 """ 289 285 self._manager = manager … … 334 330 else: 335 331 self.batch_page = SimultaneousFitPage(self, batch_on=True, 336 332 page_finder=page_finder) 337 333 self.batch_page.window_caption = caption 338 334 self.batch_page.window_name = caption … … 347 343 add an empty page 348 344 """ 349 """350 345 if self.batch_on: 351 346 from batchfitpage import BatchFitPage 352 panel = BatchFitPage(parent=self)353 #Increment index of batch page354 self.batch_page_index += 1355 index = self.batch_page_index356 else:357 """358 from fitpage import FitPage359 from batchfitpage import BatchFitPage360 if self.batch_on:361 347 panel = BatchFitPage(parent=self) 362 348 self.batch_page_index += 1 … … 365 351 else: 366 352 # Increment index of fit page 353 from fitpage import FitPage 367 354 panel = FitPage(parent=self) 368 355 self.fit_page_index += 1 … … 442 429 page = None 443 430 for p in self.opened_pages.values(): 444 # check if there is an empty page to fill up431 # check if there is an empty page to fill up 445 432 if not check_data_validity(p.get_data()) and p.batch_on: 446 433 447 # make sure data get placed in 1D empty tab if data is 1D448 # else data get place on 2D tab empty tab434 # make sure data get placed in 1D empty tab if data is 1D 435 # else data get place on 2D tab empty tab 449 436 enable2D = p.get_view_mode() 450 437 if (data.__class__.__name__ == "Data2D" and enable2D)\ … … 459 446 data_type = dlg.get_data() 460 447 dlg.Destroy() 461 if page 448 if page is None: 462 449 page = self.add_empty_page() 463 450 if data_type == 1: 464 # user has selected only data1D451 # user has selected only data1D 465 452 page.fill_data_combobox(data_1d_list) 466 453 elif data_type == 2: 467 454 page.fill_data_combobox(data_2d_list) 468 455 else: 469 # the batch analysis is canceled456 # the batch analysis is canceled 470 457 dlg.Destroy() 471 458 return None … … 504 491 try: 505 492 data = data_list[0] 506 except :493 except Exception: 507 494 # for 'fitv' files 508 495 data_list = [data] … … 512 499 return None 513 500 for page in self.opened_pages.values(): 514 # check if the selected data existing in the fitpanel501 # check if the selected data existing in the fitpanel 515 502 pos = self.GetPageIndex(page) 516 503 if not check_data_validity(page.get_data()) and not page.batch_on: 517 # make sure data get placed in 1D empty tab if data is 1D518 # else data get place on 2D tab empty tab504 # make sure data get placed in 1D empty tab if data is 1D 505 # else data get place on 2D tab empty tab 519 506 enable2D = page.get_view_mode() 520 507 if (data.__class__.__name__ == "Data2D" and enable2D)\ 521 or (data.__class__.__name__ == "Data1D" and not enable2D):508 or (data.__class__.__name__ == "Data1D" and not enable2D): 522 509 page.batch_on = self.batch_on 523 510 page._set_save_flag(not page.batch_on) 524 511 page.fill_data_combobox(data_list) 525 # caption = "FitPage" + str(self.fit_page_index)512 # caption = "FitPage" + str(self.fit_page_index) 526 513 self.SetPageText(pos, page.window_caption) 527 514 self.SetSelection(pos) … … 575 562 Delete the given page from the notebook 576 563 """ 577 # remove hint page578 # if selected_page == self.hint_page:564 # remove hint page 565 # if selected_page == self.hint_page: 579 566 # return 580 # #removing sim_page567 # removing sim_page 581 568 if selected_page == self.sim_page: 582 569 self._manager.sim_page = None … … 585 572 self._manager.batch_page = None 586 573 return 587 """ 588 # The below is not working when delete #5 and still have #6. 589 if selected_page.__class__.__name__ == "FitPage": 590 self.fit_page_index -= 1 591 else: 592 self.batch_page_index -= 1 593 """ 594 ## closing other pages 574 # closing other pages 595 575 state = selected_page.createMemento() 596 576 page_finder = self._manager.get_page_finder() 597 # #removing fit page577 # removing fit page 598 578 data = selected_page.get_data() 599 # Don' t remove plot for 2D579 # Don' t remove plot for 2D 600 580 flag = True 601 581 if data.__class__.__name__ == 'Data2D': 602 582 flag = False 603 583 if selected_page in page_finder: 604 # Delete the name of the page into the list of open page584 # Delete the name of the page into the list of open page 605 585 for uid, list in self.opened_pages.iteritems(): 606 #Don't return any panel is the exact same page is created 607 586 # Don't return any panel is the exact same page is created 608 587 if flag and selected_page.uid == uid: 609 588 self._manager.remove_plot(uid, theory=False) … … 611 590 del page_finder[selected_page] 612 591 613 # Delete the name of the page into the list of open page592 # Delete the name of the page into the list of open page 614 593 for uid, list in self.opened_pages.iteritems(): 615 # Don't return any panel is the exact same page is created594 # Don't return any panel is the exact same page is created 616 595 if selected_page.uid == uid: 617 596 del self.opened_pages[selected_page.uid] 618 597 break 619 # #remove the check box link to the model name of this page (selected_page)598 # remove the check box link to the model name of the selected_page 620 599 try: 621 600 self.sim_page.draw_page() 622 601 except: 623 # #that page is already deleted no need to remove check box on624 # #non existing page602 # that page is already deleted no need to remove check box on 603 # non existing page 625 604 pass 626 605 try: 627 606 self.batch_page.draw_page() 628 607 except: 629 # #that page is already deleted no need to remove check box on630 # #non existing page608 # that page is already deleted no need to remove check box on 609 # non existing page 631 610 pass -
src/sas/sasgui/perspectives/fitting/pagestate.py
r998ca90 re6de6b8 1640 1640 raise 1641 1641 fitstate = self._parse_state(entry) 1642 simfitstate = self._parse_simfit_state(entry)1643 1642 1644 1643 # state could be None when .svs file is loaded … … 1692 1691 datainfo=output[ind], format=ext) 1693 1692 self.state = state 1693 simfitstate = self._parse_simfit_state(entry) 1694 1694 if simfitstate is not None: 1695 1695 self.call_back(state=simfitstate)
Note: See TracChangeset
for help on using the changeset viewer.