- Timestamp:
- Apr 6, 2011 8:42:32 AM (14 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 2ca51f44
- Parents:
- 16865897
- Location:
- guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
r73581ce r1b1bbf9 20 20 from sans.guiframe.panel_base import PanelBase 21 21 22 PANEL_WIDTH = 20022 PANEL_WIDTH = 180 23 23 #PANEL_HEIGHT = 560 24 PANEL_HEIGHT = 84025 STYLE_FLAG = wx.SUNKEN_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\24 PANEL_HEIGHT = 700 25 STYLE_FLAG =wx.RAISED_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\ 26 26 wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT 27 27 … … 59 59 window_name = "Data Panel" 60 60 ## Title to appear on top of the window 61 window_caption = "Data Panel"61 window_caption = "Data Explorer" 62 62 #type of window 63 63 window_type = "Data Panel" … … 68 68 size=(PANEL_WIDTH,PANEL_HEIGHT), manager=None, *args, **kwds): 69 69 kwds['size']= size 70 kwds['style'] = STYLE_FLAG 70 71 ScrolledPanel.__init__(self, parent=parent, *args, **kwds) 71 72 PanelBase.__init__(self) … … 82 83 self.owner = None 83 84 self.do_layout() 84 85 self.Bind(wx.EVT_SHOW, self.on_close_page) 86 85 87 def do_layout(self): 86 88 """ … … 99 101 self.vbox = wx.BoxSizer(wx.VERTICAL) 100 102 self.sizer1 = wx.BoxSizer(wx.VERTICAL) 101 self.sizer1.SetMinSize((w/1 2, h*2/5))103 self.sizer1.SetMinSize((w/13, h*2/5)) 102 104 103 105 self.sizer2 = wx.BoxSizer(wx.VERTICAL) … … 637 639 theory_id=theory_id, 638 640 append=False) 639 641 642 def on_close_page(self, event=None): 643 """ 644 On close 645 """ 646 if event != None: 647 event.Skip() 648 649 # send parent to update menu with no show nor hide action 650 self.parent.show_data_panel(action=False) 651 652 640 653 def on_freeze(self, event): 641 654 """ … … 668 681 ALWAYS_ON = True 669 682 670 def __init__(self, parent=None, owner=None, manager=None,size=( 400, 800),683 def __init__(self, parent=None, owner=None, manager=None,size=(200, 800), 671 684 list_of_perspective=[],list=[], *args, **kwds): 672 685 kwds['size'] = size -
guiframe/gui_manager.py
r3450e7f r1b1bbf9 88 88 89 89 wx.Frame.__init__(self, parent=parent, title=title, pos=pos,size=size) 90 # title 91 self.title = title 90 92 # Preferred window size 91 93 self._window_width, self._window_height = size … … 132 134 #tool bar 133 135 self._toolbar = None 136 # (un)-focus color 137 #self.color = '#b3b3b3' 134 138 ## Find plug-ins 135 139 # Modify this so that we can specify the directory to look into … … 171 175 self.Bind(EVT_PANEL_ON_FOCUS, self.set_panel_on_focus) 172 176 self.Bind(EVT_APPEND_BOOKMARK, self.append_bookmark) 173 177 178 174 179 def set_input_file(self, input_file): 175 180 """ … … 204 209 #update edit menu 205 210 self.enable_edit_menu() 206 211 207 212 def build_gui(self): 208 213 """ … … 217 222 self.load_from_cmd(self._input_file) 218 223 except: 219 msg = "%s Cannot load file %s\n" %(str(APPLICATION_NAME), 220 str(self._input_file)) 221 msg += str(sys.exc_value) + '\n' 222 print msg 224 pass 223 225 self.post_init() 226 self.show_welcome_panel(None) 224 227 self.Show(True) 225 #self._check_update(None) 226 228 self._check_update(None) 229 230 227 231 def _setup_layout(self): 228 232 """ … … 236 240 default_flag = wx.aui.AUI_MGR_DEFAULT| wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE 237 241 self._mgr = wx.aui.AuiManager(self, flags=default_flag) 238 242 self._mgr.SetDockSizeConstraint(0.5, 0.5) 243 # border color 244 #self.b_color = wx.aui.AUI_DOCKART_BORDER_COLOUR 245 #self._mgr.GetArtProvider().SetColor(self.b_color, self.color) 246 #self._mgr.SetArtProvider(wx.aui.AuiDockArt(wx.AuiDefaultDockArt)) 247 #print "set", self._dockart.GetColour(13) 239 248 # Load panels 240 249 self._load_panels() … … 382 391 style = self.__gui_style & (GUIFRAME.MANAGER_ON) 383 392 if self._data_panel is not None and (p == self._data_panel): 384 panel_width_min = self._window_width * 5/25 393 panel_width_min = self._window_width * 4/25 394 panel_height_min = self._window_height * 0.8 385 395 return panel_width_min, panel_height_min 386 396 if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: … … 412 422 self._mgr.AddPane(self.defaultPanel, wx.aui.AuiPaneInfo(). 413 423 Name("default"). 414 Center ().415 CloseButton(False).416 MinimizeButton(False).424 CenterPane(). 425 #CloseButton(False). 426 #MinimizeButton(False). 417 427 # This is where we set the size of 418 428 # the application window … … 420 430 self._window_height)). 421 431 Show()) 432 422 433 #add data panel 423 434 self.panels["data_panel"] = self._data_panel … … 425 436 self._mgr.AddPane(self._data_panel, wx.aui.AuiPaneInfo(). 426 437 Name(self._data_panel.window_name). 438 Caption(self._data_panel.window_caption). 427 439 Left(). 428 440 MinimizeButton(). 429 CloseButton( False).441 CloseButton(True). 430 442 TopDockable(False). 431 443 BottomDockable(False). … … 434 446 BestSize(wx.Size(w, h)). 435 447 Hide()) 448 436 449 style = self.__gui_style & GUIFRAME.MANAGER_ON 450 data_pane = self._mgr.GetPane(self.panels["data_panel"].window_name) 437 451 if style != GUIFRAME.MANAGER_ON: 438 self._mgr.GetPane(self.panels["data_panel"].window_name).Hide()452 data_pane.Hide() 439 453 else: 440 self._mgr.GetPane(self.panels["data_panel"].window_name).Show() 441 454 data_pane.Show() 455 456 442 457 # Add the panels to the AUI manager 443 458 for panel_class in panels: 444 459 p = panel_class 445 460 id = wx.NewId() 446 w, h = self._get_panels_size(p)461 #w, h = self._get_panels_size(p) 447 462 # Check whether we need to put this panel 448 463 # in the center pane 449 464 if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: 465 w, h = self._get_panels_size(p) 450 466 if p.CENTER_PANE: 451 467 self.panels[str(id)] = p 452 468 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 453 Name(p.window_name).Caption(p.window_caption). 454 #CenterPane(). 455 Center(). 456 CloseButton(False). 457 MinimizeButton(False). 458 MinSize(wx.Size(w, h)). 459 Hide()) 469 Name(p.window_name). 470 Caption(p.window_caption). 471 #CenterPane(). 472 Center(). 473 CloseButton(False). 474 #MinimizeButton(False). 475 #BestSize(wx.Size(w, h)). 476 Hide()) 460 477 else: 461 478 self.panels[str(id)] = p … … 556 573 if style1 == GUIFRAME.FIXED_PANEL: 557 574 self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 558 Name(windowname).Caption(caption). 575 Name(windowname). 576 Caption(caption). 577 Position(10). 578 Floatable(). 579 Right(). 580 Dock(). 559 581 MinimizeButton(). 560 582 Resizable(True). 561 583 # Use a large best size to make sure the AUI 562 584 # manager takes all the available space 563 BestSize(wx.Size(PLOPANEL_WIDTH, PLOPANEL_HEIGTH)). 564 MinSize(wx.Size(PLOPANEL_WIDTH*0.9, PLOPANEL_HEIGTH))) 585 BestSize(wx.Size(PLOPANEL_WIDTH, 586 PLOPANEL_HEIGTH))) 587 #MinSize(wx.Size(PLOPANEL_WIDTH*0.9, 588 # PLOPANEL_HEIGTH))) 565 589 self._popup_fixed_panel(p) 566 590 … … 572 596 # Use a large best size to make sure the AUI 573 597 # manager takes all the available space 574 BestSize(wx.Size(PLOPANEL_WIDTH, PLOPANEL_HEIGTH))) 598 BestSize(wx.Size(PLOPANEL_WIDTH, 599 PLOPANEL_HEIGTH))) 575 600 self._popup_floating_panel(p) 576 601 577 602 pane = self._mgr.GetPane(windowname) 578 self._mgr.MaximizePane(pane)579 self._mgr.RestoreMaximizedPane()603 #self._mgr.MaximizePane(pane) 604 #self._mgr.RestoreMaximizedPane() 580 605 # Register for showing/hiding the panel 581 606 wx.EVT_MENU(self, ID, self._on_view) … … 760 785 if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 761 786 id = wx.NewId() 762 self._toolbar_menu = preferences_menu.Append(id,'& HideToolbar', '')787 self._toolbar_menu = preferences_menu.Append(id,'&Show Toolbar', '') 763 788 wx.EVT_MENU(self, id, self._on_hide_toolbar) 764 789 self._window_menu.AppendSubMenu(preferences_menu,'&Preferences') … … 943 968 if self.defaultPanel is None: 944 969 return 945 self._mgr.GetPane(self.panels["default"].window_name).Hide() 946 self._mgr.Update() 947 # set a default perspective 948 self.set_default_perspective() 949 970 default_panel = self._mgr.GetPane(self.panels["default"].window_name) 971 if default_panel.IsShown(): 972 default_panel.Hide() 973 974 # set a default perspective 975 self.set_default_perspective() 976 self._mgr.Update() 977 # Show toolbar 978 self._on_hide_toolbar() 979 950 980 def show_welcome_panel(self, event): 951 981 """ … … 965 995 self._mgr.GetPane(self.panels[id].window_name).IsShown() 966 996 self._mgr.GetPane(self.panels[id].window_name).Hide() 997 if self._toolbar != None and not self._toolbar.IsShown(): 998 self._toolbar.Show(True) 999 self._on_hide_toolbar() 1000 967 1001 self._mgr.Update() 968 1002 … … 1366 1400 if self.panels[item].ALWAYS_ON: 1367 1401 continue 1402 1368 1403 if self.panels[item].window_name in panels: 1369 1404 if not self._mgr.GetPane(self.panels[item].window_name).IsShown(): … … 1379 1414 if self._mgr.GetPane(self.panels[item].window_name).IsShown(): 1380 1415 self._mgr.GetPane(self.panels[item].window_name).Hide() 1416 1381 1417 self._mgr.Update() 1382 1418 1383 def show_data_panel(self, event=None ):1419 def show_data_panel(self, event=None, action=True): 1384 1420 """ 1385 1421 show the data panel 1386 1422 """ 1423 if self._data_panel_menu == None: 1424 return 1387 1425 label = self._data_panel_menu.GetText() 1388 1426 if label == 'Data Explorer ON': 1389 1427 pane = self._mgr.GetPane(self.panels["data_panel"].window_name) 1390 1428 #if not pane.IsShown(): 1391 pane.Show(True) 1392 self._mgr.Update() 1429 if action: 1430 pane.Show(True) 1431 self._mgr.Update() 1393 1432 self.__gui_style = self.__gui_style | GUIFRAME.MANAGER_ON 1394 1433 … … 1397 1436 pane = self._mgr.GetPane(self.panels["data_panel"].window_name) 1398 1437 #if not pane.IsShown(): 1399 pane.Show(False) 1400 self._mgr.Update() 1438 if action: 1439 pane.Show(False) 1440 self._mgr.Update() 1401 1441 self.__gui_style = self.__gui_style & (~GUIFRAME.MANAGER_ON) 1402 1442 self._data_panel_menu.SetText('Data Explorer ON') … … 1434 1474 #automatically send that to the current perspective 1435 1475 self.set_data(data_id=data_list.keys()) 1476 self.on_close_welcome_panel() 1436 1477 1437 1478 def set_data(self, data_id): … … 1442 1483 if self._current_perspective is not None: 1443 1484 self._current_perspective.set_data(list_data.values()) 1485 self.on_close_welcome_panel() 1444 1486 else: 1445 1487 msg = "Guiframe does not have a current perspective" … … 1542 1584 self._data_panel.set_active_perspective(name) 1543 1585 self._check_applications_menu() 1544 1586 #Set the SansView title 1587 self._set_title_name(name) 1588 1589 1590 def _set_title_name(self, name): 1591 """ 1592 Set the SansView title w/ the current application name 1593 1594 : param name: application name [string] 1595 """ 1596 # Set SanView Window title w/ application anme 1597 title = self.title + " - " + name + " -" 1598 self.SetTitle(title) 1599 1545 1600 def _check_applications_menu(self): 1546 1601 """ … … 1989 2044 if os.path.isfile(cmd): 1990 2045 basename = os.path.basename(cmd) 1991 app_py = str(APPLICATION_NAME).lower() + '.py' 1992 app_exe = str(APPLICATION_NAME).lower() + '.exe' 1993 if basename.lower() in [app_py, app_exe]: 2046 if basename in ['sansview.py', 'sansview.exe']: 1994 2047 input_file = sys.argv[1] 1995 2048 if input_file is None: … … 1997 2050 if self.frame is not None: 1998 2051 self.frame.set_input_file(input_file=input_file) 1999 2052 2053 2000 2054 def set_manager(self, manager): 2001 2055 """ -
guiframe/gui_toolbar.py
r6d727ae r1b1bbf9 7 7 from sans.guiframe.gui_style import GUIFRAME_ICON 8 8 from wx.lib.platebtn import PB_STYLE_SQUARE, PB_STYLE_DROPARROW 9 9 #Control panel width 10 import sys 11 if sys.platform.count("darwin")==0: 12 FONT_VARIANT = 0 13 else: 14 FONT_VARIANT = 1 15 10 16 11 17 def clear_image(image): … … 27 33 def __init__(self, parent, *args, **kwds): 28 34 Tbar.__init__(self, parent, *args, **kwds) 35 #Set window's font size 36 self.SetWindowVariant(variant=FONT_VARIANT) 29 37 self.parent = parent 30 38 self._bookmark_menu = None
Note: See TracChangeset
for help on using the changeset viewer.