Changeset 09f2328 in sasview


Ignore:
Timestamp:
Mar 3, 2017 5:03:24 PM (4 years ago)
Author:
GitHub <noreply@…>
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:
39f0bf4, 05d167e, 082239e, d0764bf, c08756f, 7e98655
Parents:
951701c (diff), a45a298 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Kienzle <pkienzle@…> (03/03/17 17:03:24)
git-committer:
GitHub <noreply@…> (03/03/17 17:03:24)
Message:

Merge pull request #17 from SasView?/expandable-de-688

Horizontal splitter to enable control of Data/Theory? boxes. Refs #688

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/data_panel.py

    rc8e1996 ra45a298  
    6666    IS_MAC = True 
    6767 
    68 STYLE_FLAG = wx.RAISED_BORDER | CT.TR_HAS_BUTTONS | CT.TR_HIDE_ROOT |\ 
    69                     wx.WANTS_CHARS | CT.TR_HAS_VARIABLE_ROW_HEIGHT 
     68STYLE_FLAG = (wx.RAISED_BORDER | CT.TR_HAS_BUTTONS | 
     69                    wx.WANTS_CHARS | CT.TR_HAS_VARIABLE_ROW_HEIGHT) 
    7070 
    7171 
     
    7474    Check list control to be used for Data Panel 
    7575    """ 
    76     def __init__(self, parent, *args, **kwds): 
     76    def __init__(self, parent, root, *args, **kwds): 
    7777        # agwstyle is introduced in wx.2.8.11 but is not working for mac 
    7878        if IS_MAC and wx_version < 812: 
     
    9797                    del kwds['style'] 
    9898                    CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) 
    99         self.root = self.AddRoot("Available Data") 
     99        self.root = self.AddRoot(root) 
    100100 
    101101    def OnCompareItems(self, item1, item2): 
     
    520520        Add a listcrtl in the panel 
    521521        """ 
    522         tree_ctrl_label = wx.StaticText(self, -1, "Data") 
    523         tree_ctrl_label.SetForegroundColour('blue') 
    524         self.tree_ctrl = DataTreeCtrl(parent=self, style=wx.SUNKEN_BORDER) 
     522        # Add splitter 
     523        w, h = self.parent.GetSize() 
     524        splitter = wx.SplitterWindow(self) 
     525        splitter.SetMinimumPaneSize(50) 
     526        splitter.SetSashGravity(1.0) 
     527 
     528        file_sizer = wx.BoxSizer(wx.VERTICAL) 
     529        file_sizer.SetMinSize(wx.Size(w/13, h*2/5)) 
     530        theory_sizer = wx.BoxSizer(wx.VERTICAL) 
     531        theory_sizer.SetMinSize(wx.Size(w/13, h*2/5)) 
     532 
     533        self.tree_ctrl = DataTreeCtrl(parent=splitter, 
     534                                      style=wx.SUNKEN_BORDER, 
     535                                      root="Available Data") 
     536 
    525537        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 
    526538        self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_MENU, self.on_right_click_data) 
     
    557569        wx.EVT_MENU(self, self.editmask_id, self.on_edit_data) 
    558570 
    559         tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory") 
    560         tree_ctrl_theory_label.SetForegroundColour('blue') 
    561         self.tree_ctrl_theory = DataTreeCtrl(parent=self, 
    562                                              style=wx.SUNKEN_BORDER) 
     571        self.tree_ctrl_theory = DataTreeCtrl(parent=splitter, 
     572                                             style=wx.SUNKEN_BORDER, 
     573                                             root="Available Theory") 
    563574        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, 
    564575                                   self.on_check_item) 
    565576        self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_MENU, 
    566577                                   self.on_right_click_theory) 
    567         self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) 
    568         self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND | wx.ALL, 10) 
    569         self.sizer1.Add(tree_ctrl_theory_label, 0,  wx.LEFT, 10) 
    570         self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND | wx.ALL, 10) 
     578        splitter.SplitHorizontally(self.tree_ctrl, self.tree_ctrl_theory) 
     579        self.sizer1.Add(splitter, 1, wx.EXPAND | wx.ALL, 10) 
    571580 
    572581    def on_right_click_theory(self, event): 
     
    722731            if self.tree_ctrl.root: 
    723732                self.tree_ctrl.SortChildren(self.tree_ctrl.root) 
     733            # Expand root if # of data sets > 0 
     734            if self.tree_ctrl.GetCount() > 0: 
     735                self.tree_ctrl.root.Expand() 
    724736        self.enable_remove() 
    725737        self.enable_import() 
     
    760772                                       state_id=state_id, 
    761773                                       theory_list=theory_list) 
     774        if self.tree_ctrl_theory.GetCount() > 0: 
     775            self.tree_ctrl_theory.root.Expand() 
    762776 
    763777    def append_theory_helper(self, tree, root, state_id, theory_list): 
Note: See TracChangeset for help on using the changeset viewer.