Changeset 0a2fdca in sasview
- Timestamp:
- Apr 12, 2011 1:00:08 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:
- a1a252e
- Parents:
- f69b5830
- Location:
- guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
r1b1bbf9 r0a2fdca 255 255 wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) 256 256 257 self.tctrl_perspective = wx.StaticText(self, -1, 'No Active Application') 257 self.tctrl_perspective = wx.StaticText(self, -1, 258 'No Active Application', 259 style=wx.SUNKEN_BORDER|wx.ALIGN_LEFT) 258 260 self.tctrl_perspective.SetToolTipString("Active Application") 259 self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') 260 self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") 261 perspective_font = self.tctrl_perspective.GetFont() 262 perspective_font.SetWeight(wx.BOLD) 263 self.tctrl_perspective.SetFont(perspective_font) 264 self.tctrl_perspective.SetClientSize((80,20)) 265 self.cb_plotpanel = wx.ComboBox(self, -1, 266 style=wx.CB_READONLY|wx.CB_SORT) 267 wx.EVT_COMBOBOX(self.cb_plotpanel,-1, self._on_plot_selection) 268 self.cb_plotpanel.Append('None') 269 self.cb_plotpanel.SetStringSelection('None') 270 271 #self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') 272 #self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") 261 273 262 274 ix = 0 … … 272 284 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 273 285 ix += 1 274 self.sizer3.Add(self. tctrl_plotpanel,(iy, ix),(1,1),286 self.sizer3.Add(self.cb_plotpanel,(iy, ix),(1,1), 275 287 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 276 288 ix = 0 … … 624 636 append plot to plot panel on focus 625 637 """ 638 self._on_plot_selection() 626 639 data_id, theory_id, state_id = self.set_data_helper() 627 640 self.parent.plot_data(data_id=data_id, … … 662 675 """ 663 676 self.tctrl_perspective.SetLabel(str(name)) 677 #perspective_font = self.tctrl_perspective.GetFont() 678 #perspective_font.SetWeight(wx.BOLD) 679 self.tctrl_perspective.SetClientSize((80,20))#SetFont(perspective_font) 664 680 665 681 def set_panel_on_focus(self, name): … … 667 683 set the plot panel on focus 668 684 """ 669 self.tctrl_plotpanel.SetLabel(str(name)) 685 for key, value in self.parent.plot_panels.iteritems(): 686 name_plot_panel = str(value.window_caption) 687 if name_plot_panel not in self.cb_plotpanel.GetItems(): 688 self.cb_plotpanel.Append(name_plot_panel, value) 689 self.cb_plotpanel.SetStringSelection(name_plot_panel) 690 670 691 692 def _on_plot_selection(self, event = None): 693 """ 694 On source combobox selection 695 """ 696 if event != None: 697 combo = event.GetEventObject() 698 event.Skip() 699 else: 700 combo = self.cb_plotpanel 701 selection = combo.GetSelection() 702 703 if combo.GetValue() != 'None': 704 panel = combo.GetClientData(selection) 705 self.parent.on_set_plot_focus(panel) 706 671 707 672 708 -
guiframe/gui_manager.py
rf69b5830 r0a2fdca 144 144 ## List of panels 145 145 self.panels = {} 146 # List of plot panels 147 self.plot_panels = {} 146 148 147 149 # Default locations … … 152 154 #panel on focus 153 155 self.panel_on_focus = None 156 #control_panel on focus 157 self.cpanel_on_focus = None 154 158 self.loader = Loader() 155 159 #data manager … … 199 203 update edit menu if available 200 204 """ 201 self.panel_on_focus = event.panel 205 if event != None: 206 self.panel_on_focus = event.panel 202 207 panel_name = 'No panel on focus' 203 208 application_name = 'No Selected Application' … … 209 214 if self._data_panel is not None: 210 215 panel_name = self.panel_on_focus.window_caption 211 self._data_panel.set_panel_on_focus(panel_name) 216 self._data_panel.set_panel_on_focus(ID)#panel_name) 217 #update combo 218 if self.panel_on_focus in self.plot_panels.values(): 219 self._data_panel.cb_plotpanel.SetStringSelection(str\ 220 (self.panel_on_focus.window_caption)) 221 elif self.panel_on_focus != self._data_panel: 222 self.cpanel_on_focus = self.panel_on_focus 212 223 #update toolbar 213 224 self._update_toolbar_helper() 214 225 #update edit menu 215 226 self.enable_edit_menu() 227 216 228 217 229 def build_gui(self): … … 612 624 # Register for showing/hiding the panel 613 625 wx.EVT_MENU(self, ID, self._on_view) 614 626 if p not in self.plot_panels.values(): 627 self.plot_panels[ID] = p 628 if self._data_panel is not None and \ 629 self._plotting_plugin is not None: 630 ind = self._data_panel.cb_plotpanel.FindString('None') 631 if ind != wx.NOT_FOUND: 632 self._data_panel.cb_plotpanel.Delete(ind) 633 self._data_panel.cb_plotpanel.Append(str(caption), p) 615 634 self._mgr.Update() 616 635 return ID … … 649 668 if self._toolbar is None: 650 669 return 651 self._toolbar.update_toolbar(self. panel_on_focus)670 self._toolbar.update_toolbar(self.cpanel_on_focus) 652 671 if self._current_perspective is not None: 653 672 application_name = self._current_perspective.sub_menu 654 if self. panel_on_focus is not None:655 panel_name = self. panel_on_focus.window_caption673 if self.cpanel_on_focus is not None: 674 panel_name = self.cpanel_on_focus.window_caption 656 675 self._toolbar.update_button(application_name=application_name, 657 676 panel_name=panel_name) … … 1037 1056 """ 1038 1057 ID = str(uid) 1058 caption = self.panels[ID].window_caption 1039 1059 config.printEVT("hide_panel: %s" % ID) 1040 1060 if ID in self.panels.keys(): 1041 1061 if self._mgr.GetPane(self.panels[ID].window_name).IsShown(): 1042 1062 self._mgr.GetPane(self.panels[ID].window_name).Hide() 1063 if self._data_panel is not None and \ 1064 ID in self.plot_panels.keys(): 1065 self._data_panel.cb_plotpanel.Append(str(caption), p) 1043 1066 # Hide default panel 1044 1067 self._mgr.GetPane(self.panels["default"].window_name).Hide() 1045 1068 self._mgr.Update() 1046 1069 1047 1070 def delete_panel(self, uid): 1048 1071 """ … … 1051 1074 ID = str(uid) 1052 1075 config.printEVT("delete_panel: %s" % ID) 1053 1076 caption = self.panels[ID].window_caption 1054 1077 if ID in self.panels.keys(): 1055 1078 panel = self.panels[ID] … … 1058 1081 panel.Destroy() 1059 1082 del self.panels[ID] 1083 del self.plot_panels[ID] 1084 if self._data_panel is not None: 1085 ind = self._data_panel.cb_plotpanel.FindString(str(caption)) 1086 if ind != wx.NOT_FOUND: 1087 self._data_panel.cb_plotpanel.Delete(ind) 1060 1088 self._mgr.Update() 1061 1089 … … 1142 1170 plug.clear_panel() 1143 1171 self.panel_on_focus = None 1172 self.cpanel_on_focus = None 1144 1173 self.get_data(path) 1145 1174 if self.defaultPanel is not None and \ … … 1224 1253 save the state of the current active application 1225 1254 """ 1226 if self. panel_on_focus is not None:1227 self. panel_on_focus.on_save(event)1255 if self.cpanel_on_focus is not None: 1256 self.cpanel_on_focus.on_save(event) 1228 1257 1229 1258 def _on_save_project(self, event): … … 1488 1517 self.on_close_welcome_panel() 1489 1518 1490 def set_data(self, data_id ):1519 def set_data(self, data_id, theory_id=None): 1491 1520 """ 1492 1521 set data to current perspective … … 1680 1709 Enable append data on a plot panel 1681 1710 """ 1711 1682 1712 if self.panel_on_focus not in self._plotting_plugin.plot_panels.values(): 1683 1713 return … … 1686 1716 1687 1717 is_data2d = hasattr(new_plot, 'data') 1718 1688 1719 is_data1d = self.panel_on_focus.__class__.__name__ == "ModelPanel1D"\ 1689 1720 and self.panel_on_focus.group_id is not None … … 1703 1734 enable menu item under edit menu depending on the panel on focus 1704 1735 """ 1705 if self. panel_on_focus is not None and self._edit_menu is not None:1706 flag = self. panel_on_focus.get_undo_flag()1736 if self.cpanel_on_focus is not None and self._edit_menu is not None: 1737 flag = self.cpanel_on_focus.get_undo_flag() 1707 1738 self._edit_menu.Enable(GUIFRAME_ID.UNDO_ID, flag) 1708 flag = self. panel_on_focus.get_redo_flag()1739 flag = self.cpanel_on_focus.get_redo_flag() 1709 1740 self._edit_menu.Enable(GUIFRAME_ID.REDO_ID, flag) 1710 flag = self. panel_on_focus.get_print_flag()1741 flag = self.cpanel_on_focus.get_print_flag() 1711 1742 self._edit_menu.Enable(GUIFRAME_ID.PRINT_ID, flag) 1712 flag = self. panel_on_focus.get_preview_flag()1743 flag = self.cpanel_on_focus.get_preview_flag() 1713 1744 self._edit_menu.Enable(GUIFRAME_ID.PREVIEW_ID, flag) 1714 flag = self. panel_on_focus.get_reset_flag()1745 flag = self.cpanel_on_focus.get_reset_flag() 1715 1746 self._edit_menu.Enable(GUIFRAME_ID.RESET_ID, flag) 1716 1747 else: … … 1726 1757 undo previous action of the last panel on focus if possible 1727 1758 """ 1728 if self. panel_on_focus is not None:1729 self. panel_on_focus.on_undo(event)1759 if self.cpanel_on_focus is not None: 1760 self.cpanel_on_focus.on_undo(event) 1730 1761 1731 1762 def on_redo_panel(self, event=None): … … 1733 1764 redo the last cancel action done on the last panel on focus 1734 1765 """ 1735 if self. panel_on_focus is not None:1736 self. panel_on_focus.on_redo(event)1766 if self.cpanel_on_focus is not None: 1767 self.cpanel_on_focus.on_redo(event) 1737 1768 1738 1769 def on_bookmark_panel(self, event=None): … … 1740 1771 bookmark panel 1741 1772 """ 1742 if self. panel_on_focus is not None:1743 self. panel_on_focus.on_bookmark(event)1773 if self.cpanel_on_focus is not None: 1774 self.cpanel_on_focus.on_bookmark(event) 1744 1775 1745 1776 def append_bookmark(self, event=None): … … 1753 1784 save possible information on the current panel 1754 1785 """ 1755 if self. panel_on_focus is not None:1756 self. panel_on_focus.on_save(event)1786 if self.cpanel_on_focus is not None: 1787 self.cpanel_on_focus.on_save(event) 1757 1788 1758 1789 def on_preview_panel(self, event=None): … … 1760 1791 preview information on the panel on focus 1761 1792 """ 1762 if self. panel_on_focus is not None:1763 self. panel_on_focus.on_preview(event)1793 if self.cpanel_on_focus is not None: 1794 self.cpanel_on_focus.on_preview(event) 1764 1795 1765 1796 def on_print_panel(self, event=None): … … 1767 1798 print available information on the last panel on focus 1768 1799 """ 1769 if self. panel_on_focus is not None:1770 self. panel_on_focus.on_print(event)1800 if self.cpanel_on_focus is not None: 1801 self.cpanel_on_focus.on_print(event) 1771 1802 1772 1803 def on_zoom_panel(self, event=None): … … 1774 1805 zoom on the current panel if possible 1775 1806 """ 1776 if self. panel_on_focus is not None:1777 self. panel_on_focus.on_zoom(event)1807 if self.cpanel_on_focus is not None: 1808 self.cpanel_on_focus.on_zoom(event) 1778 1809 1779 1810 def on_zoom_in_panel(self, event=None): … … 1781 1812 zoom in of the panel on focus 1782 1813 """ 1783 if self. panel_on_focus is not None:1784 self. panel_on_focus.on_zoom_in(event)1814 if self.cpanel_on_focus is not None: 1815 self.cpanel_on_focus.on_zoom_in(event) 1785 1816 1786 1817 def on_zoom_out_panel(self, event=None): … … 1788 1819 zoom out on the panel on focus 1789 1820 """ 1790 if self. panel_on_focus is not None:1791 self. panel_on_focus.on_zoom_out(event)1821 if self.cpanel_on_focus is not None: 1822 self.cpanel_on_focus.on_zoom_out(event) 1792 1823 1793 1824 def on_drag_panel(self, event=None): … … 1795 1826 drag apply to the panel on focus 1796 1827 """ 1797 if self. panel_on_focus is not None:1798 self. panel_on_focus.on_drag(event)1828 if self.cpanel_on_focus is not None: 1829 self.cpanel_on_focus.on_drag(event) 1799 1830 1800 1831 def on_reset_panel(self, event=None): … … 1802 1833 reset the current panel 1803 1834 """ 1804 if self. panel_on_focus is not None:1805 self. panel_on_focus.on_reset(event)1835 if self.cpanel_on_focus is not None: 1836 self.cpanel_on_focus.on_reset(event) 1806 1837 1807 1838 def enable_undo(self): … … 1809 1840 enable undo related control 1810 1841 """ 1811 if self. panel_on_focus is not None:1812 self._toolbar.enable_undo(self. panel_on_focus)1842 if self.cpanel_on_focus is not None: 1843 self._toolbar.enable_undo(self.cpanel_on_focus) 1813 1844 1814 1845 def enable_redo(self): … … 1816 1847 enable redo 1817 1848 """ 1818 if self. panel_on_focus is not None:1819 self._toolbar.enable_redo(self. panel_on_focus)1849 if self.cpanel_on_focus is not None: 1850 self._toolbar.enable_redo(self.cpanel_on_focus) 1820 1851 1821 1852 def enable_bookmark(self): … … 1823 1854 Bookmark 1824 1855 """ 1825 if self. panel_on_focus is not None:1826 self._toolbar.enable_bookmark(self. panel_on_focus)1856 if self.cpanel_on_focus is not None: 1857 self._toolbar.enable_bookmark(self.cpanel_on_focus) 1827 1858 1828 1859 def enable_save(self): … … 1830 1861 save 1831 1862 """ 1832 if self. panel_on_focus is not None:1833 self._toolbar.enable_save(self. panel_on_focus)1863 if self.cpanel_on_focus is not None: 1864 self._toolbar.enable_save(self.cpanel_on_focus) 1834 1865 1835 1866 def enable_preview(self): … … 1837 1868 preview 1838 1869 """ 1839 if self. panel_on_focus is not None:1840 self._toolbar.enable_preview(self. panel_on_focus)1870 if self.cpanel_on_focus is not None: 1871 self._toolbar.enable_preview(self.cpanel_on_focus) 1841 1872 1842 1873 def enable_print(self): … … 1844 1875 print 1845 1876 """ 1846 if self. panel_on_focus is not None:1847 self._toolbar.enable_print(self. panel_on_focus)1877 if self.cpanel_on_focus is not None: 1878 self._toolbar.enable_print(self.cpanel_on_focus) 1848 1879 1849 1880 def enable_zoom(self): … … 1851 1882 zoom 1852 1883 """ 1853 if self. panel_on_focus is not None:1884 if self.cpanel_on_focus is not None: 1854 1885 self._toolbar.enable_zoom(self.panel_on_focus) 1855 1886 … … 1858 1889 zoom in 1859 1890 """ 1860 if self. panel_on_focus is not None:1891 if self.cpanel_on_focus is not None: 1861 1892 self._toolbar.enable_zoom_in(self.panel_on_focus) 1862 1893 … … 1865 1896 zoom out 1866 1897 """ 1867 if self. panel_on_focus is not None:1898 if self.cpanel_on_focus is not None: 1868 1899 self._toolbar.enable_zoom_out(self.panel_on_focus) 1869 1900 … … 1872 1903 drag 1873 1904 """ 1874 if self. panel_on_focus is not None:1905 if self.cpanel_on_focus is not None: 1875 1906 self._toolbar.enable_drag(self.panel_on_focus) 1876 1907 … … 1879 1910 reset the current panel 1880 1911 """ 1881 if self. panel_on_focus is not None:1912 if self.cpanel_on_focus is not None: 1882 1913 self._toolbar.enable_reset(self.panel_on_focus) 1883 1914 … … 1967 1998 return self.schedule 1968 1999 1969 2000 def on_set_plot_focus(self, panel): 2001 """ 2002 Set focus on a plot panel 2003 """ 2004 for plot in self.plot_panels.values(): 2005 # make sure we don't double focus 2006 if panel != plot: 2007 plot.on_kill_focus(None) 2008 panel.on_set_focus(None) 2009 # set focusing panel 2010 self.panel_on_focus = panel 2011 self.set_panel_on_focus(None) 2012 1970 2013 def _onDrawIdle(self, *args, **kwargs): 1971 2014 """ -
guiframe/panel_base.py
rf69b5830 r0a2fdca 71 71 self._print_flag = flag 72 72 if self._manager is not None and self._manager.parent is not None: 73 self._manager.parent. panel_on_focus = self73 self._manager.parent.cpanel_on_focus = self 74 74 self._manager.parent.enable_print() 75 75 … … 91 91 self._undo_flag = flag 92 92 if self._manager is not None and self._manager.parent is not None: 93 self._manager.parent. panel_on_focus = self93 self._manager.parent.cpanel_on_focus = self 94 94 self._manager.parent.enable_undo() 95 95 … … 111 111 self._redo_flag = flag 112 112 if self._manager is not None and self._manager.parent is not None: 113 self._manager.parent. panel_on_focus = self113 self._manager.parent.cpanel_on_focus = self 114 114 self._manager.parent.enable_redo() 115 115 … … 131 131 self._zoom_in_flag = flag 132 132 if self._manager is not None and self._manager.parent is not None: 133 self._manager.parent. panel_on_focus = self133 self._manager.parent.cpanel_on_focus = self 134 134 self._manager.parent.enable_zoom_in() 135 135 … … 171 171 self._zoom_flag = flag 172 172 if self._manager is not None and self._manager.parent is not None: 173 self._manager.parent. panel_on_focus = self173 self._manager.parent.cpanel_on_focus = self 174 174 self._manager.parent.enable_zoom() 175 175 … … 191 191 self._bookmark_flag = flag 192 192 if self._manager is not None and self._manager.parent is not None: 193 self._manager.parent. panel_on_focus = self193 self._manager.parent.cpanel_on_focus = self 194 194 self._manager.parent.enable_bookmark() 195 195 … … 211 211 self._preview_flag = flag 212 212 if self._manager is not None and self._manager.parent is not None: 213 self._manager.parent. panel_on_focus = self213 self._manager.parent.cpanel_on_focus = self 214 214 self._manager.parent.enable_preview() 215 215 … … 231 231 self._save_flag = flag 232 232 if self._manager is not None and self._manager.parent is not None: 233 self._manager.parent. panel_on_focus = self233 self._manager.parent.cpanel_on_focus = self 234 234 self._manager.parent.enable_save() 235 235 … … 251 251 self._drag_flag = flag 252 252 if self._manager is not None and self._manager.parent is not None: 253 self._manager.parent. panel_on_focus = self253 self._manager.parent.cpanel_on_focus = self 254 254 self._manager.parent.enable_drag() 255 255 … … 271 271 self._reset_flag = flag 272 272 if self._manager is not None and self._manager.parent is not None: 273 self._manager.parent. panel_on_focus = self273 self._manager.parent.cpanel_on_focus = self 274 274 self._manager.parent.enable_reset() 275 275
Note: See TracChangeset
for help on using the changeset viewer.