source: sasview/calculatorview/src/sans/perspectives/calculator/pyconsole.py @ f6f75da

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since f6f75da was b1bda35, checked in by Jae Cho <jhjcho@…>, 13 years ago

little fix in comments

  • Property mode set to 100644
File size: 2.1 KB
Line 
1"""
2Console Module display Python console
3"""
4import wx
5import wx.py.crust
6import sys
7
8if sys.platform.count("win32")>0:
9    PANEL_WIDTH = 800
10    PANEL_HEIGHT = 600
11    FONT_VARIANT = 0
12else:
13    PANEL_WIDTH = 830
14    PANEL_HEIGHT = 620
15    FONT_VARIANT = 1
16   
17class PyConsole(wx.py.crust.CrustFrame):
18    ## Internal nickname for the window, used by the AUI manager
19    window_name = "Python Shell"
20    ## Name to appear on the window title bar
21    window_caption = "Python Shell"
22    ## Flag to tell the AUI manager to put this panel in the center pane
23    CENTER_PANE = False
24    def __init__(self, parent=None, manager=None,
25                    title='Python Shell', 
26                    size=(PANEL_WIDTH, PANEL_HEIGHT)):
27        if parent != None:
28            dataDir = parent._default_save_location
29        else:
30             dataDir = None
31        wx.py.crust.CrustFrame.__init__(self, parent=parent, 
32                                        title=title, size=size,
33                                        dataDir=dataDir)
34        self._import_site()
35        self.parent = parent
36        self._manager = manager
37        self.Centre()
38
39    def _import_site(self):
40        """
41        Import site for exe
42        """
43        import site
44       
45    def set_manager(self, manager):
46        """
47        Set the manager of this window
48        """
49        self._manager = manager
50       
51    def OnAbout(self, event):
52        """
53        On About
54        """
55        message = ABOUT
56        dial = wx.MessageDialog(self, message, 'About',
57                           wx.OK|wx.ICON_INFORMATION) 
58        dial.ShowModal()
59       
60ABOUT =  "Welcome to Python %s! \n\n"% sys.version.split()[0]
61ABOUT += "This uses PyCrust Shell in wx (developed by Patrick K. O'Brien).\n"
62ABOUT += "If this is your first time using Python, \n"
63ABOUT += "you should definitely check out the tutorial "
64ABOUT += "on the Internet at http://www.python.org/doc/tut/."
65 
66       
67if __name__ == "__main__":
68   
69    app  = wx.App()
70    dlg = PyConsole()
71    dlg.Show()
72    app.MainLoop()
Note: See TracBrowser for help on using the repository browser.