Changeset 2898 for branch/2frame


Ignore:
Timestamp:
Jul 3, 2017 2:12:22 PM (4 years ago)
Author:
toby
Message:

fix scroll bars on tree panel, start debugging on data panel

Location:
branch/2frame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASII.py

    r2895 r2898  
    122122            'Extinction':[0.0,False],'Babinet':{'BabA':[0.0,False],'BabU':[0.0,False]}}
    123123
    124 class GSASIIsplit(wx.SplitterWindow):
    125     def __init__(self,parent,ID):
    126         wx.SplitterWindow.__init__(self, parent, ID,style = wx.SP_BORDER|wx.SP_LIVE_UPDATE)
    127         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
    128         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
    129 
    130     def OnSashChanged(self, evt):
    131         evt.Skip()
    132 #        print "sash changed to %s\n" % str(evt.GetSashPosition())
    133 
    134     def OnSashChanging(self, evt):
    135         evt.Skip()
    136 #        print "sash changing to %s\n" % str(evt.GetSashPosition())
     124# class GSASIIsplit(wx.SplitterWindow):
     125#     def __init__(self,parent,ID):
     126#         wx.SplitterWindow.__init__(self, parent, ID,style = wx.SP_BORDER|wx.SP_LIVE_UPDATE)
     127#         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
     128#         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
     129
     130#     def OnSashChanged(self, evt):
     131#         evt.Skip()
     132# #        print "sash changed to %s\n" % str(evt.GetSashPosition())
     133
     134#     def OnSashChanging(self, evt):
     135#         evt.Skip()
     136# #        print "sash changing to %s\n" % str(evt.GetSashPosition())
    137137
    138138class GSASII(wx.Frame):
     
    187187       
    188188    def _Add_DataMenuItems(self,parent):
    189         item = parent.Append(
    190             help='',id=wx.ID_ANY,
    191             kind=wx.ITEM_NORMAL,
    192             text='Read image data...')
    193         self.Bind(wx.EVT_MENU, self.OnImageRead, id=item.GetId())
     189        # item = parent.Append(
     190        #     help='',id=wx.ID_ANY,
     191        #     kind=wx.ITEM_NORMAL,
     192        #     text='Read image data...')
     193        # self.Bind(wx.EVT_MENU, self.OnImageRead, id=item.GetId())
    194194        item = parent.Append(
    195195            help='',id=wx.ID_ANY,
     
    25362536        wx.Frame.__init__(self, name='GSASII', parent=parent,
    25372537            size=wx.Size(700, 450),style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II data tree')
     2538            #size=wx.Size(400, 450),style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II data tree')
    25382539        clientSize = wx.ClientDisplayRect()
    25392540        Size = self.GetSize()
     
    25582559        self.FillMainMenu(self.GSASIIMenu)
    25592560        self.SetMenuBar(self.GSASIIMenu)
    2560         self.Bind(wx.EVT_SIZE, self.OnSize)
     2561        #self.Bind(wx.EVT_SIZE, self.OnSize)
    25612562        self.Status = self.CreateStatusBar()
    2562 #TODO - split window tree on left, data on right
    2563         self.mainPanel = GSASIIsplit(self,-1)       
     2563        #self.mainPanel = GSASIIsplit(self,-1)
     2564        self.mainPanel = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_BORDER|wx.SP_LIVE_UPDATE)
     2565        self.mainPanel.SetMinimumPaneSize(100)
    25642566        self.treePanel = wx.Panel(self.mainPanel, wx.ID_ANY,
    25652567            style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
    2566         self.dataPanel = wx.Panel(self.mainPanel, wx.ID_ANY,
    2567             style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
    2568         self.mainPanel.SetMinimumPaneSize(100)
    2569         self.mainPanel.SplitVertically(self.treePanel, self.dataPanel, 200)
     2568        #self.dataPanel = wx.Panel(self.mainPanel, wx.ID_ANY,
     2569        #    style = wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER)
     2570        #self.mainPanel.SplitVertically(self.treePanel, self.dataPanel, 200)
     2571       
     2572        self.dataWindow = G2gd.DataWindow(self.mainPanel)
     2573        #self.dataWindow = wxscroll.ScrolledPanel(self.mainPanel,style=wx.BORDER_SUNKEN)
     2574        self.mainPanel.SplitVertically(self.treePanel, self.dataWindow, 200)
    25702575       
    25712576        wxID_PATTERNTREE = wx.NewId()
     
    25912596        self.root = self.PatternTree.root       
    25922597       
    2593         self.dataWindow = G2gd.DataWindow(self.dataPanel)
    2594         self.dataWindow.SetSize(self.dataPanel.GetClientSize())
    2595         self.dataWindow.SetAutoLayout(True)
    2596         self.dataWindow.SetInitialSize()
     2598        # def FillWindow(panel,sizer,size=1.):
     2599        #     sizer.Add(wx.StaticText(panel, wx.ID_ANY, "Panel Two: long line "+int(size*40)*'*', (5,5)))
     2600        #     for i in range(int(size*15)): sizer.Add(wx.StaticText(panel, wx.ID_ANY, "Line "+str(2+i), (5,5)))
     2601
     2602        # dataSizer = wx.BoxSizer(wx.VERTICAL)
     2603        # FillWindow(self.dataWindow,dataSizer)
     2604        # self.dataWindow.SetSizer(dataSizer)
     2605        #self.dataWindow = G2gd.DataWindow(self.dataPanel)
     2606        #self.dataWindow.SetSize(self.dataPanel.GetClientSize())
     2607        #self.dataWindow.SetInitialSize()
     2608        self.dataWindow.SetupScrolling()
    25972609        self.dataFrame = self.dataWindow        #kluge!!
    25982610#        self.SetDataSize()
     
    27102722        return self.PatternTree._getTreeItemsList(item)
    27112723
    2712     def OnSize(self,event):
    2713         'Called to make PatternTree fill mainPanel'
    2714         w,h = self.GetClientSizeTuple()
    2715         self.dataWindow.SetupScrolling()
    2716         self.mainPanel.SetSize(wx.Size(w,h))
    2717         self.PatternTree.SetSize(wx.Size(w,h))
    2718         self.dataWindow.SetSize(self.dataPanel.GetClientSize())
     2724    # def OnSize(self,event):
     2725    #     'Called to make PatternTree fill mainPanel'
     2726    #     print 'OnSize'
     2727    #     event.Skip()
     2728        # w,h = self.GetClientSizeTuple()
     2729        # self.dataWindow.SetupScrolling()
     2730        # self.mainPanel.SetSize(wx.Size(w,h))
     2731        # self.PatternTree.SetSize(wx.Size(w,h))
     2732        # self.dataWindow.SetSize(self.dataPanel.GetClientSize())
    27192733       
    27202734    def SetDataSize(self):
    2721         Size = self.GetSize()
    2722         self.SetSize(Size)
    2723         Size[1] += 1        #kluge to ensure scrollbar settings & window properly displayed
    2724         self.SetSize(Size)
     2735        self.dataWindow.Layout()
     2736        self.dataWindow.SendSizeEvent()
     2737        # print 'SetDataSize'
     2738        # Size = self.GetSize()
     2739        # self.SetSize(Size)
     2740        # Size[1] += 1        #kluge to ensure scrollbar settings & window properly displayed
     2741        # self.SetSize(Size)
    27252742                               
    27262743    def OnDataTreeSelChanged(self, event):
     
    28622879            dlg.Destroy()
    28632880                       
    2864     def OnImageRead(self,event):
    2865         '''Called to read in an image in any known format. *** Depreciated. ***
    2866         '''
    2867         G2G.G2MessageBox(self,'Please use the Import/Image/... menu item rather than this','depreciating menu item')
     2881    # def OnImageRead(self,event):
     2882    #     '''Called to read in an image in any known format. *** Depreciated. ***
     2883    #     '''
     2884    #     G2G.G2MessageBox(self,'Please use the Import/Image/... menu item rather than this','depreciating menu item')
    28682885
    28692886    def CheckNotebook(self):
     
    43534370            sys.exit()
    43544371        self.main = GSASII(None)
    4355         self.main.Show()
    43564372        self.SetTopWindow(self.main)
    43574373        # save the current package versions
     
    43934409
    43944410    #application.main.OnRefine(None)
     4411    application.SetAppDisplayName('GSAS-II')
     4412    #application.GetTopWindow().dataWindow.SendSizeEvent()
     4413    #application.GetTopWindow().treePanel.SendSizeEvent()
     4414    #application.GetTopWindow().SendSizeEvent()
     4415    application.GetTopWindow().Show(True)
    43954416    application.MainLoop()
    43964417   
  • branch/2frame/GSASIIgrid.py

    r2895 r2898  
    15691569       
    15701570    def PrefillDataMenu(self,menu,empty=False):
    1571         '''Create the "standard" part of data frame menus & add the data menu. 
    1572         On Mac, this menu duplicates the
    1573         tree menu, but adds an extra help command for the data item and a separator.
     1571        '''Create the "standard" part of data frame menus & add the dataWindow menu headings
     1572        This menu duplicates the tree menu, but adds an extra help command for the current
     1573        data item and a separator.
    15741574        '''
    15751575        self.datamenu = menu
     
    19261926        self.SampleEdit.Append(id=wxID_RESCALEALL, kind=wx.ITEM_NORMAL,text='Rescale all',
    19271927            help='Rescale all data with selected range')
    1928        
    1929 
    19301928        self.PostfillDataMenu()
    19311929        self.SetScale.Enable(False)
     
    20842082        self.ImageMenu = wx.MenuBar()
    20852083        self.PrefillDataMenu(self.ImageMenu)
    2086        
    20872084        self.ImageEdit = wx.Menu(title='')
    20882085        self.ImageMenu.Append(menu=self.ImageEdit, title='Calibration')
Note: See TracChangeset for help on using the changeset viewer.