Changeset 783940c in sasview
- Timestamp:
- Mar 21, 2011 3:00:52 PM (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:
- 6512644
- Parents:
- 119dc89
- Location:
- guiframe
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/dummyapp.py
r4753fc2 r783940c 10 10 """ 11 11 """ 12 PROG_SPLASH_PATH = None12 #PROG_SPLASH_PATH = None 13 13 STYLE = GUIFRAME.SINGLE_APPLICATION 14 14 … … 125 125 if __name__ == "__main__": 126 126 sansview = SansView() 127 -
guiframe/gui_manager.py
r3658717e r783940c 818 818 'Redo the previous action') 819 819 wx.EVT_MENU(self, GUIFRAME_ID.REDO_ID, self.on_redo_panel) 820 #self._edit_menu.AppendSeparator()821 #self._edit_menu.Append(GUIFRAME_ID.BOOKMARK_ID, '&Bookmark',822 # 'bookmark current panel')823 #wx.EVT_MENU(self, GUIFRAME_ID.BOOKMARK_ID, self.append_bookmark)824 self._edit_menu.Append(GUIFRAME_ID.SAVE_ID, '&Save As',825 'Save current panel into file')826 wx.EVT_MENU(self, GUIFRAME_ID.SAVE_ID, self.on_save_panel)827 820 self._edit_menu.AppendSeparator() 828 self._edit_menu.Append(GUIFRAME_ID.PREVIEW_ID, '& Print Preview',821 self._edit_menu.Append(GUIFRAME_ID.PREVIEW_ID, '&Report', 829 822 'Preview current panel') 830 823 wx.EVT_MENU(self, GUIFRAME_ID.PREVIEW_ID, self.on_preview_panel) … … 832 825 'Print current panel') 833 826 wx.EVT_MENU(self, GUIFRAME_ID.PRINT_ID, self.on_print_panel) 834 self._edit_menu.AppendSeparator()835 self._edit_menu.Append(GUIFRAME_ID.ZOOM_ID, '&Zoom',836 'Zoom current panel')837 wx.EVT_MENU(self, GUIFRAME_ID.ZOOM_ID, self.on_zoom_panel)838 self._edit_menu.Append(GUIFRAME_ID.ZOOM_IN_ID, '&Zoom In',839 'Zoom in current panel')840 wx.EVT_MENU(self, GUIFRAME_ID.ZOOM_IN_ID, self.on_zoom_in_panel)841 self._edit_menu.Append(GUIFRAME_ID.ZOOM_OUT_ID, '&Zoom Out',842 'Zoom out current panel')843 wx.EVT_MENU(self, GUIFRAME_ID.ZOOM_OUT_ID, self.on_zoom_out_panel)844 self._edit_menu.Append(GUIFRAME_ID.DRAG_ID, '&Drag',845 'Drag current panel')846 wx.EVT_MENU(self, GUIFRAME_ID.DRAG_ID, self.on_drag_panel)847 827 self._edit_menu.Append(GUIFRAME_ID.RESET_ID, '&Reset', 848 828 'Reset current panel') … … 1520 1500 flag = self.panel_on_focus.get_redo_flag() 1521 1501 self._edit_menu.Enable(GUIFRAME_ID.REDO_ID, flag) 1522 #flag = self.panel_on_focus.get_bookmark_flag()1523 #self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag)1524 flag = self.panel_on_focus.get_save_flag()1525 self._edit_menu.Enable(GUIFRAME_ID.SAVE_ID, flag)1526 1502 flag = self.panel_on_focus.get_print_flag() 1527 1503 self._edit_menu.Enable(GUIFRAME_ID.PRINT_ID, flag) 1528 1504 flag = self.panel_on_focus.get_preview_flag() 1529 1505 self._edit_menu.Enable(GUIFRAME_ID.PREVIEW_ID, flag) 1530 flag = self.panel_on_focus.get_zoom_flag()1531 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_ID, flag)1532 flag = self.panel_on_focus.get_zoom_in_flag()1533 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_IN_ID, flag)1534 flag = self.panel_on_focus.get_zoom_out_flag()1535 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_OUT_ID, flag)1536 flag = self.panel_on_focus.get_drag_flag()1537 self._edit_menu.Enable(GUIFRAME_ID.DRAG_ID, flag)1538 1506 flag = self.panel_on_focus.get_reset_flag() 1539 1507 self._edit_menu.Enable(GUIFRAME_ID.RESET_ID, flag) … … 1542 1510 self._edit_menu.Enable(GUIFRAME_ID.UNDO_ID, flag) 1543 1511 self._edit_menu.Enable(GUIFRAME_ID.REDO_ID, flag) 1544 #self._edit_menu.Enable(GUIFRAME_ID.BOOKMARK_ID, flag)1545 self._edit_menu.Enable(GUIFRAME_ID.SAVE_ID, flag)1546 1512 self._edit_menu.Enable(GUIFRAME_ID.PRINT_ID, flag) 1547 1513 self._edit_menu.Enable(GUIFRAME_ID.PREVIEW_ID, flag) 1548 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_ID, flag)1549 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_IN_ID, flag)1550 self._edit_menu.Enable(GUIFRAME_ID.ZOOM_OUT_ID, flag)1551 self._edit_menu.Enable(GUIFRAME_ID.DRAG_ID, flag)1552 1514 self._edit_menu.Enable(GUIFRAME_ID.RESET_ID, flag) 1553 1515 … … 1737 1699 PROG_SPLASH_PATH = PROG_SPLASH_SCREEN 1738 1700 STYLE = GUIFRAME.SINGLE_APPLICATION 1701 SPLASH_WIDTH = 500 1702 SPLASH_HEIGHT = 300 1703 SPLASH_MAX_DISPLAY_TIME = 3000 #3 sec 1704 1739 1705 def OnInit(self): 1740 1706 """ … … 1752 1718 os.path.isfile(self.PROG_SPLASH_PATH): 1753 1719 try: 1754 s elf.display_splash_screen(parent=self.frame, path=self.PROG_SPLASH_PATH)1720 s_screen = self.display_splash_screen(parent=self.frame, path=self.PROG_SPLASH_PATH) 1755 1721 except: 1756 msg = "Cannot display splash screen\n" 1757 msg += str (sys.exc_value) 1758 logging.error(msg) 1759 self.frame.Show(True) 1722 try: 1723 self.frame.Show() 1724 except: 1725 1726 msg = "Cannot display splash screen\n" 1727 msg += str (sys.exc_value) 1728 #raise 1729 logging.error(msg) 1730 else: 1731 self.frame.Show() 1732 1760 1733 1761 1734 if hasattr(self.frame, 'special'): 1762 1735 self.frame.special.SetCurrent() 1763 1736 self.SetTopWindow(self.frame) 1737 import time 1738 1764 1739 return True 1765 1740 … … 1825 1800 return (xpos, ypos), (min(x, window_width), min(y, window_height)) 1826 1801 1827 def display_splash_screen(self, parent, path=PROG_SPLASH_SCREEN): 1802 def display_splash_screen(self, parent, 1803 path=PROG_SPLASH_SCREEN): 1828 1804 """Displays the splash screen. It will exactly cover the main frame.""" 1829 1805 … … 1831 1807 x, y = parent.GetSizeTuple() 1832 1808 image = wx.Image(path, wx.BITMAP_TYPE_PNG) 1833 image.Rescale( x, y, wx.IMAGE_QUALITY_HIGH)1809 image.Rescale(self.SPLASH_WIDTH, self.SPLASH_HEIGHT, wx.IMAGE_QUALITY_HIGH) 1834 1810 bm = image.ConvertToBitmap() 1835 1811 … … 1843 1819 # Note that on Linux, the timeout appears to occur immediately in which 1844 1820 # case the splash screen disappears upon entering the event loop. 1845 wx.SplashScreen(bitmap=bm, 1846 splashStyle=(wx.SPLASH_CENTRE_ON_PARENT| 1847 wx.SPLASH_TIMEOUT| 1848 wx.STAY_ON_TOP), 1849 milliseconds=4000, 1821 s_screen = wx.SplashScreen(bitmap=bm, 1822 splashStyle=(wx.SPLASH_TIMEOUT| 1823 wx.SPLASH_CENTRE_ON_SCREEN), 1824 style=(wx.SIMPLE_BORDER| 1825 wx.FRAME_NO_TASKBAR| 1826 wx.STAY_ON_TOP), 1827 1828 milliseconds=self.SPLASH_MAX_DISPLAY_TIME, 1850 1829 parent=parent, 1851 1830 id=wx.ID_ANY) 1852 1831 1853 # Keep the splash screen up a minimum amount of time for non-Windows 1854 # systems. This is a workaround for Linux and possibly MacOS that 1855 # appear to ignore the splash screen timeout option. 1856 if '__WXMSW__' not in wx.PlatformInfo: 1857 if len(sys.argv) > 1 and '--time' in sys.argv[1:]: 1858 log_time("Starting sleep of 2 secs") 1859 time.sleep(2) 1860 1861 # A call to wx.Yield does not appear to be required. If used on 1862 # Windows, the cursor changes from 'busy' to 'ready' before the event 1863 # loop is reached which is not desirable. On Linux it seems to have 1864 # no effect. 1865 #wx.Yield() 1832 s_screen.Bind(wx.EVT_CLOSE, self.on_close_splash_screen) 1833 s_screen.Show() 1834 return s_screen 1835 1836 1837 def on_close_splash_screen(self, event): 1838 """ 1839 """ 1840 self.frame.Show(True) 1841 event.Skip() 1842 1843 1866 1844 1867 1845 -
guiframe/gui_statusbar.py
rbfa73ca r783940c 48 48 self.panel.set_message(status=status) 49 49 wx.EVT_CLOSE(self, self.Close) 50 self.Show(True)50 51 51 52 52 def set_multiple_messages(self, messages=[]): -
guiframe/gui_toolbar.py
r18ec684 r783940c 38 38 tbar_size = (22, 22) 39 39 button_type = wx.ITEM_NORMAL 40 save_im = GUIFRAME_ICON.SAVE_ICON 41 save_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH) 42 save_bmp = save_im.ConvertToBitmap() 43 #disable_save_bmp = clear_image(save_im).ConvertToBitmap() 44 disable_save_bmp = wx.NullBitmap 45 self.AddLabelTool(GUIFRAME_ID.SAVE_ID, 'Save', save_bmp, 46 disable_save_bmp,button_type, shortHelp='Save') 40 47 41 self.AddSeparator() 48 42 zoom_in_im = GUIFRAME_ICON.ZOOM_IN_ICON … … 50 44 zoom_in_bmp = zoom_in_im.ConvertToBitmap() 51 45 #disable_zoom_in_bmp = clear_image(zoom_in_im).ConvertToBitmap() 52 disable_zoom_in_bmp = wx.NullBitmap53 self.AddLabelTool(GUIFRAME_ID.ZOOM_IN_ID, 'Zoom In', zoom_in_bmp,54 disable_zoom_in_bmp, button_type,'Zoom In')55 self.AddSeparator()56 zoom_out_im = GUIFRAME_ICON.ZOOM_OUT_ICON57 zoom_out_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH)58 zoom_out_bmp = zoom_out_im.ConvertToBitmap()59 #disable_zoom_out_bmp = clear_image(zoom_out_im).ConvertToBitmap()60 disable_zoom_out_bmp = wx.NullBitmap61 self.AddLabelTool(GUIFRAME_ID.ZOOM_OUT_ID, 'Zoom Out', zoom_out_bmp,62 disable_zoom_out_bmp, button_type,'Zoom Out')63 self.AddSeparator()64 zoom_im = GUIFRAME_ICON.ZOOM_ICON65 zoom_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH)66 zoom_bmp = zoom_im.ConvertToBitmap()67 #disable_zoom_bmp = clear_image(zoom_im).ConvertToBitmap()68 disable_zoom_bmp = wx.NullBitmap69 self.AddLabelTool(GUIFRAME_ID.ZOOM_ID, 'Zoom', zoom_bmp,70 disable_zoom_bmp, button_type,'Zoom In')71 46 self.AddSeparator() 72 47 reset_im = GUIFRAME_ICON.RESET_ICON … … 81 56 drag_im.Rescale(tbar_size[0], tbar_size[1], wx.IMAGE_QUALITY_HIGH) 82 57 drag_bmp = drag_im.ConvertToBitmap() 83 #disable_drag_bmp = clear_image(drag_im).ConvertToBitmap()84 disable_drag_bmp = wx.NullBitmap85 self.AddLabelTool(GUIFRAME_ID.DRAG_ID, 'Drag', drag_bmp,86 disable_drag_bmp, button_type,'Drag')87 58 self.AddSeparator() 88 59 report_im = GUIFRAME_ICON.REPORT_ICON … … 158 129 self.parent.Bind(wx.EVT_TOOL, self.parent.on_undo_panel, 159 130 id=GUIFRAME_ID.UNDO_ID) 160 self.parent.Bind(wx.EVT_TOOL, self.parent.on_save_panel,161 id=GUIFRAME_ID.SAVE_ID)162 self.parent.Bind(wx.EVT_TOOL, self.parent.on_zoom_in_panel,163 id=GUIFRAME_ID.ZOOM_IN_ID)164 self.parent.Bind(wx.EVT_TOOL, self.parent.on_zoom_out_panel,165 id=GUIFRAME_ID.ZOOM_OUT_ID)166 self.parent.Bind(wx.EVT_TOOL, self.parent.on_zoom_panel,167 id=GUIFRAME_ID.ZOOM_ID)168 self.parent.Bind(wx.EVT_TOOL, self.parent.on_drag_panel,169 id=GUIFRAME_ID.DRAG_ID)170 131 self.parent.Bind(wx.EVT_TOOL, self.parent.on_reset_panel, 171 132 id=GUIFRAME_ID.RESET_ID) … … 188 149 self.EnableTool(GUIFRAME_ID.UNDO_ID,False) 189 150 self.EnableTool(GUIFRAME_ID.REDO_ID, False) 190 self.EnableTool(GUIFRAME_ID.ZOOM_ID, False)191 self.EnableTool(GUIFRAME_ID.ZOOM_IN_ID, False)192 self.EnableTool(GUIFRAME_ID.ZOOM_OUT_ID, False)193 151 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, False) 194 self.EnableTool(GUIFRAME_ID.SAVE_ID, False)195 self.EnableTool(GUIFRAME_ID.DRAG_ID, False)196 152 self.EnableTool(GUIFRAME_ID.RESET_ID, False) 197 153 self._bookmark_bt.Disable() … … 201 157 self.EnableTool(GUIFRAME_ID.UNDO_ID, panel.get_undo_flag()) 202 158 self.EnableTool(GUIFRAME_ID.REDO_ID, panel.get_redo_flag()) 203 self.EnableTool(GUIFRAME_ID.ZOOM_ID, panel.get_zoom_flag())204 self.EnableTool(GUIFRAME_ID.ZOOM_IN_ID, panel.get_zoom_in_flag())205 self.EnableTool(GUIFRAME_ID.ZOOM_OUT_ID, panel.get_zoom_out_flag())206 159 self.EnableTool(GUIFRAME_ID.PREVIEW_ID, panel.get_preview_flag()) 207 self.EnableTool(GUIFRAME_ID.SAVE_ID, panel.get_save_flag())208 self.EnableTool(GUIFRAME_ID.DRAG_ID, panel.get_drag_flag())209 160 self.EnableTool(GUIFRAME_ID.RESET_ID, panel.get_reset_flag()) 210 161 self._bookmark_bt.Enable(panel.get_bookmark_flag()) -
guiframe/local_perspectives/plotting/plotting.py
r4158af4 r783940c 87 87 panel.remove_data_by_id(id=id) 88 88 return True 89 else: 90 msg = "Panel with GROUP_ID: %s cannot be located" % str(group_id) 91 raise ValueError, msg 89 return False 90 91 def clear_panel(self, group_id): 92 """ 93 clear the graph 94 """ 95 if group_id in self.plot_panels.keys(): 96 panel = self.plot_panels[group_id] 97 panel.graph.reset() 98 return True 99 return False 100 92 101 93 102 def hide_panel(self, group_id): … … 170 179 _, x_unit = data.get_xaxis() 171 180 _, y_unit = data.get_yaxis() 172 if x_unit != panel.graph.prop["xunit"] \ 173 or y_unit != panel.graph.prop["yunit"]: 181 flag_x = (panel.graph.prop["xunit"] is not None) and \ 182 (panel.graph.prop["xunit"].strip() != "") and\ 183 (x_unit != panel.graph.prop["xunit"]) 184 flag_y = (panel.graph.prop["yunit"] is not None) and \ 185 (panel.graph.prop["yunit"].strip() != "") and\ 186 (x_unit != panel.graph.prop["yunit"]) 187 if (flag_x and flag_y): 174 188 msg = "Cannot add %s" % str(data.name) 175 189 msg += " to panel %s\n" % str(panel.window_caption) … … 224 238 if event.action.lower() == 'delete': 225 239 return self.delete_panel(group_id) 240 if event.action.lower() == "clear": 241 return self.clear_panel(group_id) 242 226 243 title = None 227 244 if hasattr(event, 'title'):
Note: See TracChangeset
for help on using the changeset viewer.