- Timestamp:
- Mar 4, 2015 12:51:37 PM (9 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:
- 6b0fc72
- Parents:
- 4bf54044 (diff), 76aed53 (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. - Location:
- sasview
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/__init__.py
r79492222 rd859737 6 6 __build__ = str(d.version) 7 7 except: 8 try: 9 import os 10 dir = os.path.dirname(__file__) 11 filepath = os.path.join(dir, "BUILD_NUMBER") 12 if os.path.isfile(filepath): 13 f=open(filepath, 'r') 14 buff = f.read().strip() 15 if len(buff)<50: 16 __build__ = buff 17 except: 18 import logging 19 import sys 20 logging.warning("Error while determining build number\n %s" % sys.exc_value) 8 import logging 9 import sys 10 logging.warning("Error while determining build number\n %s" % sys.exc_value) -
sasview/local_config.py
r4bf54044 r418e59f 7 7 import sas.sasview 8 8 import logging 9 from sas.guiframe.config import _do_acknowledge10 9 11 10 # Version of the application -
sasview/sasview.py
r3a39c2e r517f3d4 10 10 ################################################################################ 11 11 import os 12 import sys 12 13 import logging 13 14 from shutil import copy … … 17 18 'sasview.log')) 18 19 19 # Allow the dynamic selection of wxPython via an evironment variable, when devs 20 class StreamToLogger(object): 21 """ 22 File-like stream object that redirects writes to a logger instance. 23 """ 24 def __init__(self, logger, log_level=logging.INFO): 25 self.logger = logger 26 self.log_level = log_level 27 self.linebuf = '' 28 29 def write(self, buf): 30 # Write the message to stdout so we can see it when running interactively 31 sys.stdout.write(buf) 32 for line in buf.rstrip().splitlines(): 33 self.logger.log(self.log_level, line.rstrip()) 34 35 stderr_logger = logging.getLogger('STDERR') 36 sl = StreamToLogger(stderr_logger, logging.ERROR) 37 sys.stderr = sl 38 39 # Log the python version 40 logging.info("Python: %s" % sys.version) 41 42 # Allow the dynamic selection of wxPython via an environment variable, when devs 20 43 # who have multiple versions of the module installed want to pick between them. 21 44 # This variable does not have to be set of course, and through normal usage will … … 35 58 36 59 import wx 37 import sys 60 try: 61 logging.info("Wx version: %s" % wx.__version__) 62 except: 63 logging.error("Wx version: error reading version") 64 38 65 # The below will make sure that sasview application uses the matplotlib font 39 66 # bundled with sasview. … … 43 70 os.mkdir(mplconfigdir) 44 71 os.environ['MPLCONFIGDIR'] = mplconfigdir 45 if sys.version_info < (2, 7): 46 reload(sys) 72 reload(sys) 47 73 sys.setdefaultencoding("iso-8859-1") 48 74 from sas.guiframe import gui_manager -
sasview/welcome_panel.py
r3a39c2e r7425bcf 1 1 """ 2 2 Welcome page 3 4 3 """ 5 4 import wx … … 11 10 from wx.lib.scrolledpanel import ScrolledPanel 12 11 from sas.guiframe.panel_base import PanelBase 13 #Font size width 14 if sys.platform.count("win32") >0:12 #Font size width 13 if sys.platform.count("win32") > 0: 15 14 FONT_VARIANT = 0 16 15 else: 17 FONT_VARIANT = 1 18 16 FONT_VARIANT = 1 17 19 18 class WelcomePanel(wx.aui.AuiNotebook, PanelBase): 20 19 """ 21 20 Panel created like about box as a welcome page 22 Shows product name, current version, authors, and link to the product page. 21 Shows product name, current version, authors, 22 and link to the product page. 23 23 """ 24 24 ## Internal nickname for the window, used by the AUI manager … … 28 28 ## Flag to tell the AUI manager to put this panel in the center pane 29 29 CENTER_PANE = True 30 31 30 31 32 32 def __init__(self, parent, *args, **kwds): 33 33 kwds["style"] = wx.aui.AUI_NB_DEFAULT_STYLE 34 34 35 35 wx.aui.AuiNotebook.__init__(self, parent, *args, **kwds) 36 36 PanelBase.__init__(self) … … 38 38 self.parent = parent.parent 39 39 self.frame = None 40 40 self.manager = None 41 41 42 welcome_page = WelcomePage(self) 42 43 self.AddPage(welcome_page, "Welcome") 43 44 44 45 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_page) 45 46 self.Center() 46 47 47 48 def set_manager(self, manager): 48 49 """ … … 50 51 """ 51 52 self.manager = manager 52 53 53 54 def on_close_page(self, event): 54 55 """ 55 56 Called when the welcome panel is closed 56 57 """ 57 58 if self.parent is not None: 58 59 self.parent.on_close_welcome_panel() 59 event.Veto() 60 61 def set_data(self, list=None):60 event.Veto() 61 62 def set_data(self, data=None): 62 63 """ 63 64 """ 64 65 pass 65 66 66 67 def set_frame(self, frame): 67 68 """ … … 70 71 if frame != None: 71 72 self.frame.Bind(wx.EVT_CLOSE, self.on_close_page) 72 73 73 74 def get_frame(self): 74 75 """ 75 76 """ 76 77 return self.frame 77 78 78 79 79 80 class WelcomePage(ScrolledPanel): 80 81 """ 81 82 Panel created like about box as a welcome page 82 Shows product name, current version, authors, and link to the product page. 83 Shows product name, current version, authors, 84 and link to the product page. 83 85 """ 84 86 ## Internal nickname for the window, used by the AUI manager … … 88 90 ## Flag to tell the AUI manager to put this panel in the center pane 89 91 CENTER_PANE = True 90 91 92 93 92 94 def __init__(self, parent, *args, **kwds): 93 import local_config94 95 kwds["style"] = wx.DEFAULT_DIALOG_STYLE 95 96 96 97 ScrolledPanel.__init__(self, parent, **kwds) 97 98 self.SetupScrolling() 98 image = os.path.join( local_config._welcome_image)99 self.SetWindowVariant(variant =FONT_VARIANT)99 image = os.path.join(config._welcome_image) 100 self.SetWindowVariant(variant=FONT_VARIANT) 100 101 self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image)) 101 102 102 103 self.label_copyright = wx.StaticText(self, -1, config._copyright) 103 104 self.static_line_1 = wx.StaticLine(self, -1) 104 self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement) 105 106 self.hyperlink_license = wx.StaticText(self, -1, 105 self.label_acknowledgement = wx.StaticText(self, -1, 106 config._acknowledgement) 107 108 self.hyperlink_license = wx.StaticText(self, -1, 107 109 "Comments? Bugs? Requests?") 108 110 send_ticket = "Send us a ticket at: " 109 111 send_ticket += "help@sasview.org" 110 self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1, 111 send_ticket, URL=config._license) 112 113 self.label_title = wx.StaticText(self, -1, 114 config.__appname__+ " "+str(config.__version__)) 112 self.hyperlink_paper = \ 113 wx.lib.hyperlink.HyperLinkCtrl(self, -1, 114 send_ticket, URL=config._license) 115 116 self.label_title = \ 117 wx.StaticText(self, -1, 118 config.__appname__ + " " + str(config.__version__)) 115 119 try: 116 120 build_num = str(config.__build__) … … 118 122 build_num = str(config.__version__) 119 123 self.label_build = wx.StaticText(self, -1, "Build: " + build_num) 120 124 121 125 sizer_main = wx.BoxSizer(wx.VERTICAL) 122 126 sizer_header = wx.BoxSizer(wx.HORIZONTAL) 123 127 sizer_build = wx.BoxSizer(wx.VERTICAL) 124 125 sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND |wx.LEFT, 5)126 128 129 sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND | wx.LEFT, 5) 130 127 131 sizer_build.Add(self.label_acknowledgement, 0, 128 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)129 sizer_build.Add((5, 5))132 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 133 sizer_build.Add((5, 5)) 130 134 sizer_build.Add(self.label_title, 0, 131 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)132 sizer_build.Add(self.label_build, 0, 133 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)135 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 136 sizer_build.Add(self.label_build, 0, 137 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 134 138 sizer_build.Add(self.label_copyright, 0, 135 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)139 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 136 140 sizer_build.Add((5, 5)) 137 141 sizer_build.Add(self.hyperlink_license, 0, 138 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)142 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 139 143 sizer_build.Add(self.hyperlink_paper, 0, 140 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)141 142 sizer_main.Add(sizer_header, 0, wx.TOP |wx.EXPAND, 3)144 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 145 146 sizer_main.Add(sizer_header, 0, wx.TOP | wx.EXPAND, 3) 143 147 sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0) 144 sizer_main.Add(sizer_build, 0 , wx.BOTTOM|wx.EXPAND, 3)145 148 sizer_main.Add(sizer_build, 0, wx.BOTTOM | wx.EXPAND, 3) 149 146 150 self.SetAutoLayout(True) 147 151 self.SetSizer(sizer_main) 148 152 self.Fit() 149 150 def set_data(self, list=None):153 154 def set_data(self, data=None): 151 155 """ 152 156 """ … … 158 162 """ 159 163 def OnInit(self): 160 self.frame = WelcomeFrame(None, -1, "Test App") 164 self.frame = WelcomeFrame(None, -1, "Test App") 161 165 self.frame.Show(True) 162 166 return True … … 171 175 self.Centre() 172 176 self.Show(True) 173 174 if __name__ == "__main__": 177 178 if __name__ == "__main__": 175 179 app = ViewApp(0) 176 180 app.MainLoop()
Note: See TracChangeset
for help on using the changeset viewer.