Changeset 7a67e075 in sasview


Ignore:
Timestamp:
Jan 26, 2011 3:54:16 PM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
3feed3e
Parents:
0912feab
Message:

working on guiframe views

Location:
guiframe
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • guiframe/gui_manager.py

    r52b8b74 r7a67e075  
    5656    def __init__(self, parent, id, title,  
    5757                 window_height=300, window_width=300, 
    58                  gui_style=GUIFRAME.SINGLE_APPLICATION): 
     58                 gui_style=GUIFRAME.DEFAULT_STYLE): 
    5959        """ 
    6060        Initialize the Frame object 
     
    161161        default_flag = wx.aui.AUI_MGR_DEFAULT| wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE 
    162162        self._mgr = wx.aui.AuiManager(self, flags=default_flag) 
    163         """ 
    164         if self.__gui_style in [GUIFRAME.MULTIPLE_APPLICATIONS]: 
    165             from data_panel import DataPanel 
    166             self._data_panel = DataPanel(self) 
    167             """ 
     163    
    168164        # Load panels 
    169165        self._load_panels() 
    170166        self._mgr.Update() 
    171167         
    172     def _layout(self, style): 
    173         """ 
    174         Layout the frame according to a style 
    175         """ 
    176         if self.__gui_style == GUIFRAME.SINGLE_APPLICATION: 
    177             #Divide the frame into  
    178             print "GUIFRAME.SINGLE_APPLICATION" 
    179         elif self.__gui_style == GUIFRAME.MULTIPLE_APPLICATIONS: 
    180             print 'GUIFRAME.MULTIPLE_APPLICATION' 
    181         elif self.__gui_style == GUIFRAME.FLOATING_PANEL: 
    182             print "GUIFRAME.FLOATING_PANEL" 
    183              
    184168    def SetStatusText(self, *args, **kwds): 
    185169        """ 
     
    220204        plugins = [] 
    221205        #import guiframe local plugins 
    222         if self.__gui_style == GUIFRAME.DATALOADER_ON: 
     206        #check if the style contain guiframe.dataloader 
     207        style1 = self.__gui_style & GUIFRAME.DATALOADER_ON 
     208        style2 = self.__gui_style & GUIFRAME.PLOTTIN_ON 
     209        style3 = self.__gui_style & (GUIFRAME.DATALOADER_ON|GUIFRAME.PLOTTIN_ON) 
     210        
     211        if style1 == GUIFRAME.DATALOADER_ON: 
    223212            try: 
    224213                from sans.guiframe.local_perspectives.data_loader import data_loader 
     
    229218                msg += "cannot import dataloader plugin.\n %s" % sys.exc_value 
    230219                logging.error(msg) 
    231         elif self.__gui_style == GUIFRAME.PLOTTIN_ON: 
     220        elif style2 == GUIFRAME.PLOTTIN_ON: 
    232221            try: 
    233222                from sans.guiframe.local_perspectives.plotting import plotting 
     
    237226                msg = "ViewerFrame._find_plugins:" 
    238227                msg += "cannot import plotting plugin.\n %s" % sys.exc_value 
    239         elif self.__gui_style in [6, 7, 8]: 
     228        elif style3 in (GUIFRAME.DATALOADER_ON|GUIFRAME.PLOTTIN_ON): 
    240229            try: 
    241230                from sans.guiframe.local_perspectives.data_loader import data_loader 
     
    362351                                          CenterPane(). 
    363352                                          #BestSize(wx.Size(550,600)). 
    364                                           #MinSize(wx.Size(500,500)). 
     353                                 MinSize(wx.Size(self._window_width*3/5,-1)). 
    365354                                          Hide()) 
    366355            else: 
     
    402391        ID = wx.NewId() 
    403392        self.panels[str(ID)] = p 
    404          
    405393        count = 0 
    406394        for item in self.panels: 
     
    415403        p.window_caption = caption 
    416404             
    417         self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 
    418                           Name(windowname).Caption(caption). 
    419                           Floatable(). 
    420                           #Float(). 
    421                           Right(). 
    422                           Dock(). 
    423                           TopDockable(). 
    424                           BottomDockable(). 
    425                           LeftDockable(). 
    426                           RightDockable(). 
    427                           MinimizeButton(). 
    428                           #Hide(). 
    429                           #Show(). 
    430                           Resizable(True). 
    431                           # Use a large best size to make sure the AUI manager 
    432                           # takes all the available space 
    433                           BestSize(wx.Size(400,400))) 
     405        style1 = self.__gui_style & GUIFRAME.FIXED_PANEL 
     406        style2 = self.__gui_style & GUIFRAME.FLOATING_PANEL 
     407        if style1 == GUIFRAME.FIXED_PANEL: 
     408            self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 
     409                              Name(windowname).Caption(caption). 
     410                              Floatable(). 
     411                              Right(). 
     412                              Dock(). 
     413                              TopDockable(). 
     414                              BottomDockable(). 
     415                              LeftDockable(). 
     416                              RightDockable(). 
     417                              MinimizeButton(). 
     418                              #Hide(). 
     419                              #Show(). 
     420                              Resizable(True). 
     421                              # Use a large best size to make sure the AUI manager 
     422                              # takes all the available space 
     423                              BestSize(wx.Size(400,400))) 
     424        elif style2 in GUIFRAME.FLOATING_PANEL: 
     425            self._mgr.AddPane(p, wx.aui.AuiPaneInfo(). 
     426                              Name(windowname).Caption(caption). 
     427                              Floatable(). 
     428                              Float(). 
     429                               
     430                              #FloatingPosition(wx.Size(self._window_width/5,self._window_height/3)). 
     431                              Right(). 
     432                              Dock(). 
     433                              TopDockable(). 
     434                              BottomDockable(). 
     435                              LeftDockable(). 
     436                              RightDockable(). 
     437                              MinimizeButton(). 
     438                              #Hide(). 
     439                              #Show(). 
     440                              Resizable(True). 
     441                              # Use a large best size to make sure the AUI manager 
     442                              # takes all the available space 
     443                              BestSize(wx.Size(400,400))) 
     444             
    434445        pane = self._mgr.GetPane(windowname) 
    435446        self._mgr.MaximizePane(pane) 
     
    464475        self._add_menu_application() 
    465476        self._add_menu_window() 
    466         
    467  
    468          
    469   
    470477        # Tools menu 
    471478        # Go through plug-ins and find tools to populate the tools menu 
     
    547554             
    548555            wx.EVT_MENU(self, id, self.show_welcome_panel) 
    549         if self.__gui_style in [GUIFRAME.MANAGER_ON, 
    550                                  GUIFRAME.MULTIPLE_APPLICATIONS]: 
     556        style = self.__gui_style & GUIFRAME.MANAGER_ON 
     557        if style == GUIFRAME.MANAGER_ON: 
    551558            id = wx.NewId() 
    552559            self._window_menu.Append(id,'&Data Manager', '') 
    553              
    554560            wx.EVT_MENU(self, id, self.show_data_panel) 
    555561             
     562        id = wx.NewId() 
     563        preferences_menu = wx.Menu() 
     564        hint = "Plot panels will floating" 
     565        preferences_menu.Append(id, '&Floating Plot Panel', hint) 
     566        wx.EVT_MENU(self, id, self.set_plotpanel_floating) 
     567        id = wx.NewId() 
     568        hint = "Plot panels will displayed within the frame" 
     569        preferences_menu.Append(id, '&Fixed Plot Panel', hint) 
     570        wx.EVT_MENU(self, id, self.set_plotpanel_fixed) 
     571        id = wx.NewId() 
     572        self._window_menu.AppendSubMenu(preferences_menu,'&Preferences') 
     573        #wx.EVT_MENU(self, id, self.show_preferences_panel)    
    556574        """ 
    557575        if len(self.plugins) == 2: 
     
    580598        add menu application 
    581599        """ 
    582         if self.__gui_style in [GUIFRAME.MULTIPLE_APPLICATIONS]: 
     600        style = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
     601        if style == GUIFRAME.MULTIPLE_APPLICATIONS: 
    583602            p_menu = wx.Menu() 
    584603            for plug in self.plugins: 
     
    625644                         '&Load Data File(s)', data_file_hint) 
    626645        wx.EVT_MENU(self, data_file_id, self._load_data) 
    627         if self.__gui_style == GUIFRAME.SINGLE_APPLICATION: 
     646        style = self.__gui_style & GUIFRAME.SINGLE_APPLICATION 
     647        if style == GUIFRAME.SINGLE_APPLICATION: 
    628648            self._menubar.Append(self._data_menu, '&Data') 
    629649            return  
     
    10211041        """ 
    10221042        self._current_perspective = perspective 
     1043         
     1044    def set_plotpanel_floating(self, event): 
     1045        """ 
     1046        make the plot panel floatable 
     1047        """ 
     1048    def set_plotpanel_fixed(self, event): 
     1049        """ 
     1050        make the plot panel fixed 
     1051        """ 
    10231052 
    10241053class DefaultPanel(wx.Panel): 
  • guiframe/gui_style.py

    r52b8b74 r7a67e075  
    77    MANAGER_ON = 1 
    88    FLOATING_PANEL = 2 
    9     FIXED_PANEL = 3 
    10     PLOTTIN_ON = 4 
    11     DATALOADER_ON = 5 
    12     SINGLE_APPLICATION = 6 
    13     MULTIPLE_APPLICATIONS = 7 
    14      
    15     DEFAULT_STYLE = 8 
     9    FIXED_PANEL = 4 
     10    PLOTTIN_ON = 8 
     11    DATALOADER_ON = 16 
     12    TOOL_ON = 32 
     13    SINGLE_APPLICATION = 64 
     14    DEFAULT_STYLE = SINGLE_APPLICATION|DATALOADER_ON|PLOTTIN_ON|FIXED_PANEL 
     15    MULTIPLE_APPLICATIONS = DEFAULT_STYLE|MANAGER_ON 
    1616 
    1717if __name__ == "__main__": 
     
    1919    print GUIFRAME.DEFAULT_STYLE 
    2020    print GUIFRAME.FLOATING_PANEL 
     21    print GUIFRAME.SINGLE_APPLICATION 
     22    style = GUIFRAME.MULTIPLE_APPLICATIONS 
     23    style &= GUIFRAME.PLOTTIN_ON 
     24    print style == GUIFRAME.PLOTTIN_ON 
     25    style1 = GUIFRAME.MULTIPLE_APPLICATIONS 
     26    style1 &= (~GUIFRAME.MANAGER_ON) 
     27    print style1 == GUIFRAME.DEFAULT_STYLE 
     28    print style1 
     29     
    2130  
    22     value = GUIFRAME.MANAGER_ON|GUIFRAME.DATALOADER_ON 
    23     print value 
    24     print value in [1,2] 
    25     print value in [5,2] 
    26     print value in [GUIFRAME.MANAGER_ON,GUIFRAME.DATALOADER_ON] 
     31   
  • guiframe/local_perspectives/plotting/Plotter1D.py

    r52b8b74 r7a67e075  
    8787        self.graph.render(self) 
    8888        #bind with event to contrst context menu 
    89         self.parent.Bind(EVT_NEW_LOADED_DATA, self._add_new_plot) 
     89        #self.parent.Bind(EVT_NEW_LOADED_DATA, self._add_new_plot) 
    9090         
    9191    def on_add_new_plot(self, event): 
     
    253253        self._slicerpop.Append(id, '&Print Preview', 'image preview for print') 
    254254        wx.EVT_MENU(self, id, self.onPrinterPreview) 
     255        """ 
    255256        #add plot 
    256257        self._menu_add_plot = wx.Menu() 
     
    262263        self._slicerpop.AppendSubMenu(self._menu_add_plot, '&Add New Plot') 
    263264        self._fill_menu_add_plot() 
     265        """ 
    264266        self._slicerpop.AppendSeparator() 
    265267        #add menu of other plugins 
Note: See TracChangeset for help on using the changeset viewer.